root/contributed_modules/modules/capturegroups/asterisk-1.4-pickupbycallid.patch
| Revision 8398, 5.1 kB (checked in by Maikel, 4 years ago) |
|---|
-
channels/chan_sip.c
old new 508 508 #define DEFAULT_ALLOW_EXT_DOM TRUE 509 509 #define DEFAULT_REALM "asterisk" 510 510 #define DEFAULT_NOTIFYRINGING TRUE 511 #define DEFAULT_SENDCALLINFO TRUE 511 512 #define DEFAULT_PEDANTIC FALSE 512 513 #define DEFAULT_AUTOCREATEPEER FALSE 513 514 #define DEFAULT_QUALIFY FALSE … … 539 540 static int global_limitonpeers; /*!< Match call limit on peers only */ 540 541 static int global_rtautoclear; 541 542 static int global_notifyringing; /*!< Send notifications on ringing */ 543 static int global_sendcallinfo; /*!< Send info about called and calling party */ 542 544 static int global_notifyhold; /*!< Send notifications on hold */ 543 545 static int global_alwaysauthreject; /*!< Send 401 Unauthorized for all failing requests */ 544 546 static int srvlookup; /*!< SRV Lookup on or off. Default is on */ … … 7225 7227 size_t maxbytes = sizeof(tmp); 7226 7228 struct sip_request req; 7227 7229 char hint[AST_MAX_EXTENSION]; 7230 char hint3[AST_MAX_EXTENSION] ; 7228 7231 char *statestring = "terminated"; 7229 7232 const struct cfsubscription_types *subscriptiontype; 7230 7233 enum state { NOTIFY_OPEN, NOTIFY_INUSE, NOTIFY_CLOSED } local_state = NOTIFY_OPEN; … … 7284 7287 if (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten)) { 7285 7288 char *hint2 = hint, *individual_hint = NULL; 7286 7289 int hint_count = 0, unavailable_count = 0; 7290 7291 ast_get_hint(hint3, sizeof(hint3), NULL, 0, NULL, p->context, p->exten); 7287 7292 7288 7293 while ((individual_hint = strsep(&hint2, "&"))) { 7289 7294 hint_count++; … … 7373 7378 case DIALOG_INFO_XML: /* SNOM subscribes in this format */ 7374 7379 ast_build_string(&t, &maxbytes, "<?xml version=\"1.0\"?>\n"); 7375 7380 ast_build_string(&t, &maxbytes, "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"%d\" state=\"%s\" entity=\"%s\">\n", p->dialogver++, full ? "full":"partial", mto); 7376 if ((state & AST_EXTENSION_RINGING) && global_notifyringing) 7377 ast_build_string(&t, &maxbytes, "<dialog id=\"%s\" direction=\"recipient\">\n", p->exten); 7381 if ((state & AST_EXTENSION_RINGING) && global_notifyringing) { 7382 if (global_sendcallinfo && !ast_strlen_zero(hint)) { 7383 struct ast_channel *chan = NULL; 7384 struct sip_pvt *np = NULL; 7385 struct sip_user *local_user = NULL; 7386 7387 while ((chan = ast_channel_walk_locked(chan)) != NULL) { 7388 if((chan->_state == AST_STATE_RINGING || chan->_state == AST_STATE_DOWN) && chan->tech_pvt) { 7389 char *hint2 = hint3, *individual_hint = NULL; 7390 7391 while ((individual_hint = strsep(&hint2, "&"))) { 7392 if (!strncasecmp(chan->name, individual_hint, strlen(individual_hint))) { 7393 np = chan->tech_pvt; 7394 local_user = find_user(np->peername, 1); 7395 ast_build_string(&t, &maxbytes, "<dialog id=\"%s\" direction=\"recipient\" call-id=\"%s\" local-tag=\"%s\" remote-tag=\"%s\">\n", p->exten, np->callid, np->tag, np->theirtag); 7396 ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring); 7397 ast_build_string(&t, &maxbytes, "<local>\n"); 7398 ast_build_string(&t, &maxbytes, "<identity display=\"%s\">%s</identity>\n", local_user->cid_name, np->uri); 7399 ast_build_string(&t, &maxbytes, "<target uri=\"%s\"/>\n", np->uri); 7400 ast_build_string(&t, &maxbytes, "</local>\n"); 7401 ast_build_string(&t, &maxbytes, "<remote>\n"); 7402 ast_build_string(&t, &maxbytes, "<identity display=\"%s\">sip:%s@%s</identity>\n", np->fromname, np->fromuser, p->fromdomain); 7403 ast_build_string(&t, &maxbytes, "<target uri=\"sip:%s@%s\"/>\n", p->exten, p->fromdomain); 7404 ast_build_string(&t, &maxbytes, "</remote>\n"); 7405 ast_log(LOG_DEBUG, "Sent call-pickup info to peer %s\n", p->peername); 7406 ast_mutex_unlock(&chan->lock); 7407 break; /* everything done, jump out of channel walk */ 7408 } 7409 } 7410 } 7411 ast_mutex_unlock(&chan->lock); 7412 } 7413 if (!np) { 7414 ast_build_string(&t, &maxbytes, "<dialog id=\"%s\" direction=\"recipient\">\n", p->exten); 7415 } 7416 } else { 7417 ast_build_string(&t, &maxbytes, "<dialog id=\"%s\" direction=\"recipient\">\n", p->exten); 7418 } 7419 7420 } 7378 7421 else 7379 7422 ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten); 7380 7423 ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring); … … 17385 17431 global_regcontext[0] = '\0'; 17386 17432 expiry = DEFAULT_EXPIRY; 17387 17433 global_notifyringing = DEFAULT_NOTIFYRINGING; 17434 global_sendcallinfo = DEFAULT_SENDCALLINFO; 17388 17435 global_limitonpeers = FALSE; 17389 17436 global_directrtpsetup = FALSE; /* Experimental feature, disabled by default */ 17390 17437 global_notifyhold = FALSE; … … 17521 17568 global_directrtpsetup = ast_true(v->value); 17522 17569 } else if (!strcasecmp(v->name, "notifyringing")) { 17523 17570 global_notifyringing = ast_true(v->value); 17571 } else if (!strcasecmp(v->name, "sendcallinfo")) { 17572 global_sendcallinfo = ast_true(v->value); 17524 17573 } else if (!strcasecmp(v->name, "notifyhold")) { 17525 17574 global_notifyhold = ast_true(v->value); 17526 17575 } else if (!strcasecmp(v->name, "alwaysauthreject")) {
Note: See TracBrowser for help on using the browser.
