Настройка статусных линий (BLF) для Cisco Phone и Asterisk

Any VoIP technologies, hardware and software. Like SIP, H.323, MGCP, Asterisk, Call Controls, IP Phones...

Moderator: sva

Настройка статусных линий (BLF) для Cisco Phone и Asterisk

Postby mik on Fri Feb 12, 2010 12:41 pm

Собственно для того чтобы работали статусные кнопки в cisco ip-телефонах (я тренировался на 7965 и 7945) при работе с Asterisk 1.6 с использованием SIP необходимо:

1. пропатчить файлик channels/chan_sip.c (в моем случае астериск 1.6.0.18):

Code: Select all
--- chan_sip.c-orig     2010-02-12 11:08:59.000000000 +0200
+++ chan_sip.c  2010-02-12 11:07:16.000000000 +0200
@@ -314,7 +314,8 @@
        DIALOG_INFO_XML,
        CPIM_PIDF_XML,
        PIDF_XML,
-       MWI_NOTIFICATION
+       MWI_NOTIFICATION,
+       CISCO_PIDF_XML
};

/*! \brief Subscription types that we support. We support
@@ -334,7 +335,8 @@
        { CPIM_PIDF_XML,   "presence", "application/cpim-pidf+xml",   "cpim-pidf+xml" },  /* RFC 3863 */
        { PIDF_XML,        "presence", "application/pidf+xml",        "pidf+xml" },       /* RFC 3863 */
        { XPIDF_XML,       "presence", "application/xpidf+xml",       "xpidf+xml" },       /* Pre-RFC 3863 with MS additions */
-       { MWI_NOTIFICATION,     "message-summary", "application/simple-message-summary", "mwi" } /* RFC 3842: Mailbox notification */
+       { MWI_NOTIFICATION,     "message-summary", "application/simple-message-summary", "mwi" }, /* RFC 3842: Mailbox notification */
+       { CISCO_PIDF_XML,  "presence", "application/pidf+xml",        "pidf+xml" },       /* RFC 3863 with Cisco wonkiness */
};


@@ -9817,6 +9819,45 @@
                        ast_str_append(&tmp, 0, "<status><basic>%s</basic></status>\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
                ast_str_append(&tmp, 0, "</tuple>\n</presence>\n");
                break;
+       case CISCO_PIDF_XML: /* Cisco-tailored pidf */
+               ast_str_append(&tmp, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+               ast_str_append(&tmp, 0, "<presence entity=\"%s\" xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:e=\"urn:ietf:params:xml:ns:pidf:status:rpid\" xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:ce=\"urn:cisco:params:xml:ns:pidf:rpid\" xmlns:sc=\"urn:ietf:params:xml:ns:pidf:servcaps\">\n", mfrom);
+               ast_str_append(&tmp, 0, "       <dm:person>\n");
+               ast_str_append(&tmp, 0, "               <e:activities>\n");
+               switch (state) {
+                       case AST_EXTENSION_BUSY:                // all busy
+                               ast_str_append(&tmp, 0, "                       <r:busy/>\n");
+                               break;
+                       case AST_EXTENSION_INUSE:               // one or more busy
+                               ast_str_append(&tmp, 0, "                       <e:on-the-phone/>\n");
+                               break;
+                       case AST_EXTENSION_RINGING:             // ringing ;-)
+                               ast_str_append(&tmp, 0, "                       <ce:alerting/>\n");
+                               break;
+                       case AST_EXTENSION_NOT_INUSE:   // idle
+                               ast_str_append(&tmp, 0, "                       <ce:available/>\n");
+                               break;
+                       case AST_EXTENSION_UNAVAILABLE: // unavailable or unregisterd
+                               ast_str_append(&tmp, 0, "                       <ce:unavailable/>\n");
+                               break;
+                       case AST_EXTENSION_ONHOLD:              // XXX: parked
+                               ast_str_append(&tmp, 0, "                       <ce:unavailable/>\n");
+                               break;
+                       case AST_EXTENSION_REMOVED:             // extension removed
+                       case AST_EXTENSION_DEACTIVATED: // extension hint removed
+                       default:
+                               ast_str_append(&tmp, 0, "                       <r:unknown/>\n");
+                               ast_log(LOG_NOTICE, "Activity %d is not implemented in CISCO_PIDF_XML\n", state);
+               }
+               ast_str_append(&tmp, 0, "               </e:activities>\n");
+               ast_str_append(&tmp, 0, "       </dm:person>\n");
+               ast_str_append(&tmp, 0, "       <tuple id=\"%s\">\n", p->exten);
+               ast_str_append(&tmp, 0, "               <status>\n");
+               ast_str_append(&tmp, 0, "                       <basic>%s</basic>\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
+               ast_str_append(&tmp, 0, "               </status>\n");
+               ast_str_append(&tmp, 0, "       </tuple>\n");
+               ast_str_append(&tmp, 0, "</presence>\n");
+               break;
        case DIALOG_INFO_XML: /* SNOM subscribes in this format */
                ast_str_append(&tmp, 0, "<?xml version=\"1.0\"?>\n");
                ast_str_append(&tmp, 0, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full":"partial", mto);
@@ -19101,6 +19142,8 @@
                 * they only support xpidf+xml. */
                if (pidf_xml && strstr(p->useragent, "Polycom")) {
                        p->subscribed = XPIDF_XML;
+               } else if (strstr(p->useragent, "Cisco")) {
+                       p->subscribed = CISCO_PIDF_XML;
                } else if (pidf_xml) {
                        p->subscribed = PIDF_XML;         /* RFC 3863 format */
                } else if (strstr(accept, "application/dialog-info+xml")) {
@@ -19981,6 +20024,7 @@
                /* Build temporary dialog for this message */
                if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL)))
                        return -1;
+                p->socket.type = 0;
                if (create_addr_from_peer(p, peer)) {
                        /* Maybe they're not registered, etc. */
                        dialog_cleanup_and_destroy(p); /*sip_destroy(p);*/


Включить поддержку в sip.conf
Code: Select all
[general]
tcpenable=yes                    ; BLF у цискофонов работает по tcp

allowsubscribe=yes              ; Disable support for subscriptions. (Default is yes)
;subscribecontext = default     ; Set a specific context for SUBSCRIBE requests
                                ; Useful to limit subscriptions to local extensions
                                ; Settable per peer/user also
notifyringing = yes            ; Control whether subscriptions already INUSE get sent
                                ; RINGING when another call is sent (default: no)
notifyhold = yes               ; Notify subscriptions on HOLD state (default: no)
                                ; Turning on notifyringing and notifyhold will add a lot
                                ; more database transactions if you are using realtime.
callcounter = yes              ; Enable call counters on devices. This can be set per
                                ; device too.
;counteronpeer = yes            ; Apply call counting on peers only. This will improve
                                ; status notification when you are using type=friend
                                ; Inbound calls, that really apply to the user part
                                ; of a friend will now be added to and compared with
                                ; the peer counter instead of applying two call counters,
                                ; one for the peer and one for the user.
                                ; "sip show inuse" will only show active calls on
                                ; the peer side of a "type=friend" object if this
                                ; setting is turned on.



3. в extensions.conf для соответствующего номера (например номер 100, за которым хотим следить) добавляем:
exten => 100,hint,SIP/100

4. в файлик конфигурации телефона SEPMAC.cnf.xml добавляем описание кнопок:
Code: Select all
<device>
....skip....
    <sipProfile>
....skip....
        <sipLines>
            <line button="2">
                <featureID>21</featureID>
                <featureLabel>one hundred</featureLabel>
                <speedDialNumber>100</speedDialNumber>
            </line>
        </sipLines>
    </sipProfile>
</device>



Пока разбирался нашел полезную доку в которой описан xml-формат сообщений телефону о состояниях (presence)
Developer Guide for Cisco Unified Presence v7.0.pdf
Developer Guide for Cisco Unified Presence
(1.75 MiB) Downloaded 583 times
Yuriy Mykhaylov, CCNP and CCDP, Tel/Fax: +380 44 545-7788, icq: 30408323
User avatar
mik
Site Admin
 
Posts: 56
Joined: Tue Feb 05, 2008 6:48 pm
Location: Kiyv, Ukraine

Return to voip

Who is online

Users browsing this forum: No registered users and 4 guests

cron