root/contributed_modules/modules/capturegroups/asterisk-1.4-pickupbycallid.patch

Revision 8398, 5.1 kB (checked in by Maikel, 4 years ago)

Asterisk 1.4 Patch required by keylock module

  • channels/chan_sip.c

    old new  
    508508#define DEFAULT_ALLOW_EXT_DOM TRUE 
    509509#define DEFAULT_REALM   "asterisk" 
    510510#define DEFAULT_NOTIFYRINGING TRUE 
     511#define DEFAULT_SENDCALLINFO  TRUE 
    511512#define DEFAULT_PEDANTIC  FALSE 
    512513#define DEFAULT_AUTOCREATEPEER  FALSE 
    513514#define DEFAULT_QUALIFY   FALSE 
     
    539540static int global_limitonpeers;   /*!< Match call limit on peers only */ 
    540541static int global_rtautoclear; 
    541542static int global_notifyringing;  /*!< Send notifications on ringing */ 
     543static int global_sendcallinfo;   /*!< Send info about called and calling party */ 
    542544static int global_notifyhold;   /*!< Send notifications on hold */ 
    543545static int global_alwaysauthreject; /*!< Send 401 Unauthorized for all failing requests */ 
    544546static int srvlookup;     /*!< SRV Lookup on or off. Default is on */ 
     
    72257227  size_t maxbytes = sizeof(tmp); 
    72267228  struct sip_request req; 
    72277229  char hint[AST_MAX_EXTENSION]; 
     7230  char hint3[AST_MAX_EXTENSION] ; 
    72287231  char *statestring = "terminated"; 
    72297232  const struct cfsubscription_types *subscriptiontype; 
    72307233  enum state { NOTIFY_OPEN, NOTIFY_INUSE, NOTIFY_CLOSED } local_state = NOTIFY_OPEN; 
     
    72847287  if (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten)) { 
    72857288    char *hint2 = hint, *individual_hint = NULL; 
    72867289    int hint_count = 0, unavailable_count = 0; 
     7290     
     7291    ast_get_hint(hint3, sizeof(hint3), NULL, 0, NULL, p->context, p->exten); 
    72877292 
    72887293    while ((individual_hint = strsep(&hint2, "&"))) { 
    72897294      hint_count++; 
     
    73737378  case DIALOG_INFO_XML: /* SNOM subscribes in this format */ 
    73747379    ast_build_string(&t, &maxbytes, "<?xml version=\"1.0\"?>\n"); 
    73757380    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    } 
    73787421    else 
    73797422      ast_build_string(&t, &maxbytes, "<dialog id=\"%s\">\n", p->exten); 
    73807423    ast_build_string(&t, &maxbytes, "<state>%s</state>\n", statestring); 
     
    1738517431  global_regcontext[0] = '\0'; 
    1738617432  expiry = DEFAULT_EXPIRY; 
    1738717433  global_notifyringing = DEFAULT_NOTIFYRINGING; 
     17434  global_sendcallinfo = DEFAULT_SENDCALLINFO; 
    1738817435  global_limitonpeers = FALSE; 
    1738917436  global_directrtpsetup = FALSE;    /* Experimental feature, disabled by default */ 
    1739017437  global_notifyhold = FALSE; 
     
    1752117568      global_directrtpsetup = ast_true(v->value); 
    1752217569    } else if (!strcasecmp(v->name, "notifyringing")) { 
    1752317570      global_notifyringing = ast_true(v->value); 
     17571    } else if (!strcasecmp(v->name, "sendcallinfo")) { 
     17572      global_sendcallinfo = ast_true(v->value); 
    1752417573    } else if (!strcasecmp(v->name, "notifyhold")) { 
    1752517574      global_notifyhold = ast_true(v->value); 
    1752617575    } else if (!strcasecmp(v->name, "alwaysauthreject")) { 
Note: See TracBrowser for help on using the browser.