aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6fcd10d86..3b5b10048 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3682,11 +3682,17 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
ast_update_use_count();
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->rdnis))
- tmp->cid.cid_rdnis = ast_strdup(i->rdnis);
+
+ /* Don't use ast_set_callerid() here because it will
+ * generate a NewCallerID event before the NewChannel event */
+ tmp->cid.cid_num = ast_strdup(i->cid_num);
+ tmp->cid.cid_ani = ast_strdup(i->cid_num);
+ tmp->cid.cid_name = ast_strdup(i->cid_name);
+ tmp->cid.cid_rdnis = ast_strdup(i->rdnis);
+
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
tmp->cid.cid_dnid = ast_strdup(i->exten);
+
tmp->priority = 1;
if (!ast_strlen_zero(i->uri))
pbx_builtin_setvar_helper(tmp, "SIPURI", i->uri);