]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Sat, 5 Aug 2006 06:04:09 +0000 (06:04 +0000)
committerAutomerge script <automerge@asterisk.org>
Sat, 5 Aug 2006 06:04:09 +0000 (06:04 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@38927 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channel.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_modem.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_vpb.c
channels/chan_zap.c

index efc099b0d33edb87f8e4767dd09e98148be182c3..830def79600e8f49296828cfd518487fe4aa0c01 100644 (file)
--- a/channel.c
+++ b/channel.c
@@ -3440,7 +3440,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
        }
 
        for (/* ever */;;) {
-               struct timeval now;
+               struct timeval now = { 0, };
                int to;
 
                to = -1;
index d9057a16cd0b51d9818bcfe92f934d08dfd2ee42..814c546f9e71772a603ce8c87b57bd3104d8c696 100644 (file)
@@ -770,15 +770,15 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
                        ch->amaflags = pvt->amaflags;
                }
 
-               /*
-                * If cid_num and cdi.call_source_e164 are both null, then
-                * ast_set_callerid will do the right thing and leave the
-                * cid_num and cid_ani for the channel alone.
-                */
-               ast_set_callerid(ch,
-                       !ast_strlen_zero(pvt->cid_num) ? pvt->cid_num : pvt->cd.call_source_e164,
-                       pvt->cid_name,
-                       !ast_strlen_zero(pvt->cid_num) ? pvt->cid_num : pvt->cd.call_source_e164);
+               if (!ast_strlen_zero(pvt->cid_num)) {
+                       ch->cid.cid_num = strdup(pvt->cid_num);
+                       ch->cid.cid_ani = strdup(pvt->cid_num);
+               } else if (!ast_strlen_zero(pvt->cd.call_source_e164)) {
+                       ch->cid.cid_num = strdup(pvt->cd.call_source_e164);
+                       ch->cid.cid_ani = strdup(pvt->cd.call_source_e164);
+               }
+               if (!ast_strlen_zero(pvt->cid_name))
+                       ch->cid.cid_name = strdup(pvt->cid_name);
 
                if (!ast_strlen_zero(pvt->rdnis)) {
                        ch->cid.cid_rdnis = strdup(pvt->rdnis);
index d1e33f408d44d407a212e0c636e69bb2c73b753f..61fc2ca3636c1580a665ada60cdc1b5e86f2c4ea 100644 (file)
@@ -3442,15 +3442,22 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
                tmp->writeformat = ast_best_codec(capability);
                tmp->tech_pvt = CALLNO_TO_PTR(i->callno);
 
-               ast_set_callerid(tmp, i->cid_num, i->cid_name,
-                       i->ani ? i->ani : i->cid_num);
+               if (!ast_strlen_zero(i->cid_num))
+                       tmp->cid.cid_num = strdup(i->cid_num);
+               if (!ast_strlen_zero(i->cid_name))
+                       tmp->cid.cid_name = strdup(i->cid_name);
+               if (!ast_strlen_zero(i->ani))
+                       tmp->cid.cid_ani = strdup(i->ani);
+               else if (!ast_strlen_zero(i->cid_num))
+                       tmp->cid.cid_ani = strdup(i->cid_num);
+               tmp->cid.cid_pres = i->calling_pres;
+               tmp->cid.cid_ton = i->calling_ton;
+               tmp->cid.cid_tns = i->calling_tns;
+
                if (!ast_strlen_zero(i->language))
                        ast_copy_string(tmp->language, i->language, sizeof(tmp->language));
                if (!ast_strlen_zero(i->dnid))
                        tmp->cid.cid_dnid = strdup(i->dnid);
-               tmp->cid.cid_pres = i->calling_pres;
-               tmp->cid.cid_ton = i->calling_ton;
-               tmp->cid.cid_tns = i->calling_tns;
                if (!ast_strlen_zero(i->accountcode))
                        ast_copy_string(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode));
                if (i->amaflags)
@@ -3461,10 +3468,6 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
                i->owner = tmp;
                i->capability = capability;
                ast_setstate(tmp, state);
-               ast_mutex_lock(&usecnt_lock);
-               usecnt++;
-               ast_mutex_unlock(&usecnt_lock);
-               ast_update_use_count();
                if (state != AST_STATE_DOWN) {
                        if (ast_pbx_start(tmp)) {
                                ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -3475,6 +3478,10 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
                for (v = i->vars ; v ; v = v->next)
                        pbx_builtin_setvar_helper(tmp,v->name,v->value);
                
+               ast_mutex_lock(&usecnt_lock);
+               usecnt++;
+               ast_mutex_unlock(&usecnt_lock);
+               ast_update_use_count();
        }
        return tmp;
 }
index 9fca447b08e591c1534208bf6b7e07e56ef8eac9..8190d9e3aea3593f3bbf726e48a4dcf60535b2b8 100644 (file)
@@ -1428,7 +1428,14 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
                strncpy(tmp->call_forward, i->call_forward, sizeof(tmp->call_forward) - 1);
                strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
                strncpy(tmp->exten, i->exten, sizeof(tmp->exten)-1);
-               ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
+
+               if (!ast_strlen_zero(i->cid_num)) {
+                       tmp->cid.cid_num = strdup(i->cid_num);
+                       tmp->cid.cid_ani = strdup(i->cid_num);
+               }
+               if (!ast_strlen_zero(i->cid_name))
+                       tmp->cid.cid_name = strdup(i->cid_name);
+               
                if (!i->adsi)
                        tmp->adsicpe = AST_ADSI_UNAVAILABLE;
                tmp->priority = 1;
index 2538d35836a270427cd63d346f2d536014c69117..a170105ff159b06603100a1154ffd479741f0eaf 100644 (file)
@@ -2164,7 +2164,12 @@ struct ast_channel *misdn_new(struct chan_list *chlist, int state, char * name,
                        char *cid_name, *cid_num;
       
                        ast_callerid_parse(callerid, &cid_name, &cid_num);
-                       ast_set_callerid(tmp, cid_num, cid_name, cid_num);
+                       if (!ast_strlen_zero(cid_num)) {
+                               tmp->cid.cid_num = strdup(cid_num);
+                               tmp->cid.cid_ani = strdup(cid_num);
+                       }
+                       if (!ast_strlen_zero(cid_name))
+                               tmp->cid.cid_name = strdup(cid_name);
                }
 
                {
index 6718db141cdcde84f6d55a3b5e14a3801a0d8f25..8be355ea59f7c1be2f8f755286cc175668b4f105 100644 (file)
@@ -573,7 +573,12 @@ struct ast_channel *ast_modem_new(struct ast_modem_pvt *i, int state)
                tmp->tech_pvt = i;
                strncpy(tmp->context, i->context, sizeof(tmp->context)-1);
 
-               ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
+               if (!ast_strlen_zero(i->cid_num)) {
+                       tmp->cid.cid_num = strdup(i->cid_num);
+                       tmp->cid.cid_ani = strdup(i->cid_num);
+               }
+               if (!ast_strlen_zero(i->cid_name))
+                       tmp->cid.cid_name = strdup(i->cid_name);
 
                if (!ast_strlen_zero(i->language))
                        strncpy(tmp->language,i->language, sizeof(tmp->language)-1);
index 0cb57fc11253cbb027f99a6560634c301fed76e8..18fc8eaf8c8a35af4e76f84409fa675bd21197c6 100644 (file)
@@ -825,7 +825,14 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
                        strncpy(tmp->exten, "s",  sizeof(tmp->exten) - 1);
                if (!ast_strlen_zero(i->language))
                        strncpy(tmp->language, i->language, sizeof(tmp->language)-1);
-               ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
+
+               if (!ast_strlen_zero(i->cid_num)) {
+                       tmp->cid.cid_num = strdup(i->cid_num);
+                       tmp->cid.cid_ani = strdup(i->cid_num);
+               }
+               if (!ast_strlen_zero(i->cid_name))
+                       tmp->cid.cid_name = strdup(i->cid_name);
+
                i->owner = tmp;
                ast_mutex_lock(&usecnt_lock);
                usecnt++;
index 30e1b725aa16c6880c8b0d4b37a3dc2fedb34fc2..8c52d3526fa33703b8aa62ad1ff6f3a3ce5a10be 100644 (file)
@@ -2859,16 +2859,20 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
        if (!ast_strlen_zero(i->musicclass))
                ast_copy_string(tmp->musicclass, i->musicclass, sizeof(tmp->musicclass));
        i->owner = tmp;
-       ast_mutex_lock(&usecnt_lock);
-       usecnt++;
-       ast_mutex_unlock(&usecnt_lock);
        ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
        ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
-       ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
+
+       if (!ast_strlen_zero(i->cid_num)) {
+               tmp->cid.cid_num = strdup(i->cid_num);
+               tmp->cid.cid_ani = strdup(i->cid_num);
+       }
+       if (!ast_strlen_zero(i->cid_name))
+               tmp->cid.cid_name = strdup(i->cid_name);
        if (!ast_strlen_zero(i->rdnis))
                tmp->cid.cid_rdnis = strdup(i->rdnis);
        if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
                tmp->cid.cid_dnid = strdup(i->exten);
+
        tmp->priority = 1;
        if (!ast_strlen_zero(i->uri)) {
                pbx_builtin_setvar_helper(tmp, "SIPURI", i->uri);
@@ -2898,6 +2902,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
        for (v = i->chanvars ; v ; v = v->next)
                pbx_builtin_setvar_helper(tmp,v->name,v->value);
                                
+       ast_mutex_lock(&usecnt_lock);
+       usecnt++;
+       ast_mutex_unlock(&usecnt_lock);
+       ast_update_use_count(); 
+       
        return tmp;
 }
 
index c35b0281089941f467cbaa590e9cda021b2f7861..e4ffe81657cf9f63856ebb48c0200dbba040ac65 100644 (file)
@@ -2279,7 +2279,14 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state)
                strncpy(tmp->call_forward, l->call_forward, sizeof(tmp->call_forward) - 1);
                strncpy(tmp->context, l->context, sizeof(tmp->context)-1);
                strncpy(tmp->exten,l->exten, sizeof(tmp->exten)-1);
-               ast_set_callerid(tmp, l->cid_num, l->cid_name, l->cid_num);
+
+               if (!ast_strlen_zero(l->cid_num)) {
+                       tmp->cid.cid_num = strdup(l->cid_num);
+                       tmp->cid.cid_ani = strdup(l->cid_num);
+               }
+               if (!ast_strlen_zero(l->cid_name))
+                       tmp->cid.cid_name = strdup(l->cid_name);
+
                tmp->priority = 1;
                tmp->adsicpe = AST_ADSI_UNAVAILABLE;
 
index f735e3d16e95e0ac487561e8c5e15f2885c60e17..0b067124b95a9fc41e8617c8fa7f45c761593467 100644 (file)
@@ -2647,7 +2647,12 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, int state, char *context)
                        cid_name[0] = '\0';
                        cid_num[0] = '\0';
                        ast_callerid_split(me->callerid, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
-                       ast_set_callerid(tmp, cid_num, cid_name, cid_num);
+                       if (!ast_strlen_zero(cid_num)) {
+                               tmp->cid.cid_num = strdup(cid_num);
+                               tmp->cid.cid_ani = strdup(cid_num);
+                       }
+                       if (!ast_strlen_zero(cid_name))
+                               tmp->cid.cid_name = strdup(cid_name);
                }
                tmp->tech_pvt = me;
                
index 2cd028a01f3e32e5e5a1e2392a2a00177072354a..aea3085349a895d988a0ef2bf4bbcac647b944d8 100644 (file)
@@ -5118,9 +5118,21 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
                        tmp->cid.cid_dnid = strdup(i->dnid);
 
 #ifdef PRI_ANI
-               ast_set_callerid(tmp, i->cid_num, i->cid_name, ast_strlen_zero(i->cid_ani) ? i->cid_num : i->cid_ani);
+               if (!ast_strlen_zero(i->cid_num))
+                       tmp->cid.cid_num = strdup(i->cid_num);
+               if (!ast_strlen_zero(i->cid_name))
+                       tmp->cid.cid_name = strdup(i->cid_name);
+               if (!ast_strlen_zero(i->cid_ani))
+                       tmp->cid.cid_ani = strdup(i->cid_num);
+               else if (!ast_strlen_zero(i->cid_num))  
+                       tmp->cid.cid_ani = strdup(i->cid_num);
 #else
-               ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
+               if (!ast_strlen_zero(i->cid_num)) {
+                       tmp->cid.cid_num = strdup(i->cid_num);
+                       tmp->cid.cid_ani = strdup(i->cid_num);
+               }
+               if (!ast_strlen_zero(i->cid_name))
+                       tmp->cid.cid_name = strdup(i->cid_name);
 #endif
                tmp->cid.cid_pres = i->callingpres;
                tmp->cid.cid_ton = i->cid_ton;