[asterisk-commits] rmudgett: branch group/issue8824 r142276 - in /team/group/issue8824: apps/ ch...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 9 15:15:23 CDT 2008
Author: rmudgett
Date: Tue Sep 9 15:15:22 2008
New Revision: 142276
URL: http://svn.digium.com/view/asterisk?view=rev&rev=142276
Log:
* Replaced struct ast_connectedline with struct ast_party_connected_line
* Changed the connected line update API to pass more information.
* Added party ID helper functions.
* Added initial redirecting information enhancement support.
* Added initial AST_CONTROL_REDIRECTING control frame support.
* Added ton and source data types to the dialplan CONNECTEDLINE()
function.
Remaining to do:
* Update chan_misdn.c redirecting support.
* Complete redirecting support in asterisk core.
* Add enhanced redirecting support to the other channel types.
Modified:
team/group/issue8824/apps/app_dial.c
team/group/issue8824/apps/app_queue.c
team/group/issue8824/channels/chan_agent.c
team/group/issue8824/channels/chan_dahdi.c
team/group/issue8824/channels/chan_features.c
team/group/issue8824/channels/chan_h323.c
team/group/issue8824/channels/chan_iax2.c
team/group/issue8824/channels/chan_local.c
team/group/issue8824/channels/chan_mgcp.c
team/group/issue8824/channels/chan_misdn.c
team/group/issue8824/channels/chan_phone.c
team/group/issue8824/channels/chan_sip.c
team/group/issue8824/channels/chan_skinny.c
team/group/issue8824/channels/chan_unistim.c
team/group/issue8824/funcs/func_connectedline.c
team/group/issue8824/include/asterisk/channel.h
team/group/issue8824/include/asterisk/frame.h
team/group/issue8824/main/channel.c
team/group/issue8824/main/dial.c
team/group/issue8824/main/features.c
team/group/issue8824/main/rtp.c
Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Tue Sep 9 15:15:22 2008
@@ -512,17 +512,11 @@
} else {
ast_rtp_make_compatible(c, in, single);
- S_REPLACE(c->cid.cid_num, ast_strdup(in->cid.cid_num));
- S_REPLACE(c->cid.cid_name, ast_strdup(in->cid.cid_name));
- S_REPLACE(c->cid.cid_ani, ast_strdup(in->cid.cid_ani));
S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(in->macroexten, in->exten)));
-
- c->cid.cid_pres = in->cid.cid_pres;
- c->cid.cid_ton = in->cid.cid_ton;
c->cid.cid_tns = in->cid.cid_tns;
- c->cid.cid_ani2 = in->cid.cid_ani2;
-
- ast_set_connectedline(c, in->lid.lid_num, in->lid.lid_name, in->lid.lid_pres);
+
+ ast_party_caller_copy(&c->cid, &in->cid);
+ ast_party_connected_line_copy(&c->connected, &in->connected);
if (ast_call(c, tmpchan, 0)) {
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
@@ -561,6 +555,7 @@
#ifdef HAVE_EPOLL
struct chanlist *epollo;
#endif
+ struct ast_party_id caller_id;
if (single) {
/* Turn off hold music, etc */
@@ -570,8 +565,10 @@
/* If we are calling a single channel, make them compatible for in-band tone purpose */
ast_channel_make_compatible(outgoing->chan, in);
- if (!ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(outgoing, DIAL_NOCONNECTEDLINE))
- ast_connectedline_update(in, outgoing->chan->cid.cid_num, outgoing->chan->cid.cid_name, outgoing->chan->cid.cid_pres);
+ if (!ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(outgoing, DIAL_NOCONNECTEDLINE)) {
+ ast_party_id_collect_caller_id(&caller_id, &outgoing->chan->cid);
+ ast_connected_line_update(in, &caller_id, 0 /*! \todo XXX Need an answer value to put here */);
+ }
}
#ifdef HAVE_EPOLL
@@ -618,8 +615,10 @@
if (ast_test_flag64(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) {
if (!peer) {
ast_verb(3, "%s answered %s\n", c->name, in->name);
- if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE))
- ast_connectedline_update(in, c->cid.cid_num, c->cid.cid_name, c->cid.cid_pres);
+ if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
+ ast_party_id_collect_caller_id(&caller_id, &c->cid);
+ ast_connected_line_update(in, &caller_id, 0 /*! \todo XXX Need an answer value to put here */);
+ }
peer = c;
ast_copy_flags64(peerflags, o,
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
@@ -658,8 +657,10 @@
/* This is our guy if someone answered. */
if (!peer) {
ast_verb(3, "%s answered %s\n", c->name, in->name);
- if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE))
- ast_connectedline_update(in, c->cid.cid_num, c->cid.cid_name, c->cid.cid_pres);
+ if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE) && !ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
+ ast_party_id_collect_caller_id(&caller_id, &c->cid);
+ ast_connected_line_update(in, &caller_id, 0 /*! \todo XXX Need an answer value to put here */);
+ }
peer = c;
if (peer->cdr) {
peer->cdr->answer = ast_tvnow();
@@ -724,13 +725,17 @@
ast_verb(3, "%s requested a source update, passing it to %s\n", c->name, in->name);
ast_indicate(in, AST_CONTROL_SRCUPDATE);
break;
- case AST_CONTROL_CONNECTEDLINE:
+ case AST_CONTROL_CONNECTED_LINE:
if (!single || ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
ast_verb(3, "Connected line update to %s prevented.\n", in->name);
} else {
ast_verb(3, "%s connected line has changed, passing it to %s\n", c->name, in->name);
- ast_indicate_data(in, AST_CONTROL_CONNECTEDLINE, f->data.ptr, f->datalen);
+ ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
}
+ break;
+ case AST_CONTROL_REDIRECTING:
+ ast_verb(3, "%s redirecting info has changed, passing it to %s\n", c->name, in->name);
+ ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
break;
case AST_CONTROL_PROCEEDING:
ast_verb(3, "%s is proceeding passing it to %s\n", c->name, in->name);
@@ -847,7 +852,8 @@
(f->subclass == AST_CONTROL_UNHOLD) ||
(f->subclass == AST_CONTROL_VIDUPDATE) ||
(f->subclass == AST_CONTROL_SRCUPDATE) ||
- (f->subclass == AST_CONTROL_CONNECTEDLINE))) {
+ (f->subclass == AST_CONTROL_CONNECTED_LINE) ||
+ (f->subclass == AST_CONTROL_REDIRECTING))) {
ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
}
@@ -1499,8 +1505,8 @@
/* If the new channel has no callerid, try to guess what it should be */
if (ast_strlen_zero(tc->cid.cid_num)) {
- if (!ast_strlen_zero(chan->lid.lid_num)) {
- ast_set_callerid(tc, chan->lid.lid_num, chan->lid.lid_name, chan->lid.lid_ani);
+ if (!ast_strlen_zero(chan->connected.id.number)) {
+ ast_set_callerid(tc, chan->connected.id.number, chan->connected.id.name, chan->connected.ani);
} else if (!ast_strlen_zero(chan->cid.cid_dnid)) {
ast_set_callerid(tc, chan->cid.cid_dnid, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(chan->macroexten, chan->exten))) {
@@ -1509,18 +1515,22 @@
ast_set_flag64(tmp, DIAL_NOCONNECTEDLINE);
}
- if (ast_test_flag64(peerflags, OPT_FORCE_CALLERID))
- ast_set_connectedline(tc, cid_num, cid_name, AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
+ if (ast_test_flag64(peerflags, OPT_FORCE_CALLERID)) {
+ struct ast_party_id line_id;
+
+ ast_party_id_set_init(&line_id, &tc->connected.id);
+ line_id.number = cid_num;
+ line_id.name = cid_name;
+ line_id.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+ ast_set_connected_line(tc, &line_id, tc->connected.source);
+ }
else {
- S_REPLACE(tc->lid.lid_num, ast_strdup(chan->cid.cid_num));
- S_REPLACE(tc->lid.lid_name, ast_strdup(chan->cid.cid_name));
- S_REPLACE(tc->lid.lid_ani, ast_strdup(chan->cid.cid_ani));
S_REPLACE(tc->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
-
- tc->lid.lid_pres = chan->cid.cid_pres;
- tc->lid.lid_ton = chan->cid.cid_ton;
+ ast_party_redirecting_copy(&tc->redirecting, &chan->redirecting);
+
tc->cid.cid_tns = chan->cid.cid_tns;
- tc->lid.lid_ani2 = chan->cid.cid_ani2;
+
+ ast_copy_caller_to_connected(&tc->connected, &chan->cid);
}
ast_string_field_set(tc, accountcode, chan->accountcode);
Modified: team/group/issue8824/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/apps/app_queue.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/apps/app_queue.c (original)
+++ team/group/issue8824/apps/app_queue.c Tue Sep 9 15:15:22 2008
@@ -2080,9 +2080,9 @@
/* If the new channel has no callerid, try to guess what it should be */
if (ast_strlen_zero(tmp->chan->cid.cid_num)) {
- if (!ast_strlen_zero(qe->chan->lid.lid_num)) {
- ast_set_callerid(tmp->chan, qe->chan->lid.lid_num, qe->chan->lid.lid_name, qe->chan->lid.lid_ani);
- tmp->chan->cid.cid_pres = qe->chan->lid.lid_pres;
+ if (!ast_strlen_zero(qe->chan->connected.id.number)) {
+ ast_set_callerid(tmp->chan, qe->chan->connected.id.number, qe->chan->connected.id.name, qe->chan->connected.ani);
+ tmp->chan->cid.cid_pres = qe->chan->connected.id.number_presentation;
} else if (!ast_strlen_zero(qe->chan->cid.cid_dnid)) {
ast_set_callerid(tmp->chan, qe->chan->cid.cid_dnid, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(qe->chan->macroexten, qe->chan->exten))) {
@@ -2091,23 +2091,14 @@
tmp->update_connectedline = 0;
}
- if (tmp->chan->lid.lid_num)
- ast_free(tmp->chan->lid.lid_num);
- tmp->chan->lid.lid_num = ast_strdup(qe->chan->cid.cid_num);
- if (tmp->chan->lid.lid_name)
- ast_free(tmp->chan->lid.lid_name);
- tmp->chan->lid.lid_name = ast_strdup(qe->chan->cid.cid_name);
- if (tmp->chan->lid.lid_ani)
- ast_free(tmp->chan->lid.lid_ani);
- tmp->chan->lid.lid_ani = ast_strdup(qe->chan->cid.cid_ani);
if (tmp->chan->cid.cid_rdnis)
ast_free(tmp->chan->cid.cid_rdnis);
tmp->chan->cid.cid_rdnis = ast_strdup(qe->chan->cid.cid_rdnis);
-
- tmp->chan->lid.lid_pres = qe->chan->cid.cid_pres;
- tmp->chan->lid.lid_ton = qe->chan->cid.cid_ton;
+ ast_party_redirecting_copy(&tmp->chan->redirecting, &qe->chan->redirecting);
+
tmp->chan->cid.cid_tns = qe->chan->cid.cid_tns;
- tmp->chan->lid.lid_ani2 = qe->chan->cid.cid_ani2;
+
+ ast_copy_caller_to_connected(&tmp->chan->connected, &qe->chan->cid);
/* Inherit specially named variables from parent channel */
ast_channel_inherit_variables(qe->chan, tmp->chan);
@@ -2408,6 +2399,7 @@
#ifdef HAVE_EPOLL
struct callattempt *epollo;
#endif
+ struct ast_party_id caller_id;
starttime = (long) time(NULL);
#ifdef HAVE_EPOLL
@@ -2462,7 +2454,8 @@
if (!peer) {
ast_verb(3, "%s answered %s\n", o->chan->name, in->name);
if (update_connectedline && o->update_connectedline) {
- ast_connectedline_update(in, o->chan->cid.cid_num, o->chan->cid.cid_name, o->chan->cid.cid_pres);
+ ast_party_id_collect_caller_id(&caller_id, &o->chan->cid);
+ ast_connected_line_update(in, &caller_id, 0 /*! \todo XXX Need an answer value to put here */);
}
peer = o;
}
@@ -2503,28 +2496,14 @@
ast_channel_inherit_variables(in, o->chan);
ast_channel_datastore_inherit(in, o->chan);
- if (o->chan->cid.cid_num)
- ast_free(o->chan->cid.cid_num);
- o->chan->cid.cid_num = ast_strdup(in->cid.cid_num);
-
- if (o->chan->cid.cid_name)
- ast_free(o->chan->cid.cid_name);
- o->chan->cid.cid_name = ast_strdup(in->cid.cid_name);
-
- if (o->chan->cid.cid_ani)
- ast_free(o->chan->cid.cid_ani);
- o->chan->cid.cid_ani = ast_strdup(in->cid.cid_ani);
-
if (o->chan->cid.cid_rdnis)
ast_free(o->chan->cid.cid_rdnis);
o->chan->cid.cid_rdnis = ast_strdup(S_OR(in->macroexten, in->exten));
- o->chan->cid.cid_pres = in->cid.cid_pres;
- o->chan->cid.cid_ton = in->cid.cid_ton;
o->chan->cid.cid_tns = in->cid.cid_tns;
- o->chan->cid.cid_ani2 = in->cid.cid_ani2;
-
- ast_set_connectedline(o->chan, in->lid.lid_num, in->lid.lid_name, in->lid.lid_pres);
+
+ ast_party_caller_copy(&o->chan->cid, &in->cid);
+ ast_party_connected_line_copy(&o->chan->connected, &in->connected);
if (ast_call(o->chan, tmpchan, 0)) {
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
@@ -2545,7 +2524,8 @@
if (!peer) {
ast_verb(3, "%s answered %s\n", o->chan->name, in->name);
if (update_connectedline && o->update_connectedline) {
- ast_connectedline_update(in, o->chan->cid.cid_num, o->chan->cid.cid_name, o->chan->cid.cid_pres);
+ ast_party_id_collect_caller_id(&caller_id, &o->chan->cid);
+ ast_connected_line_update(in, &caller_id, 0 /*! \todo XXX Need an answer value to put here */);
}
peer = o;
}
@@ -2586,15 +2566,21 @@
case AST_CONTROL_OFFHOOK:
/* Ignore going off hook */
break;
- case AST_CONTROL_CONNECTEDLINE:
+ case AST_CONTROL_CONNECTED_LINE:
if (!update_connectedline) {
ast_verb(3, "Connected line update to %s prevented.\n", in->name);
} else {
ast_verb(3, "%s connected line has changed, passing it to %s\n", o->chan->name, in->name);
- ast_indicate_data(in, AST_CONTROL_CONNECTEDLINE, f->data.ptr, f->datalen);
+ ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
}
+ break;
+ case AST_CONTROL_REDIRECTING:
+ ast_verb(3, "%s redirecting info has changed, passing it to %s\n", o->chan->name, in->name);
+ ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
+ break;
default:
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
+ break;
}
}
ast_frfree(f);
Modified: team/group/issue8824/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_agent.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_agent.c (original)
+++ team/group/issue8824/channels/chan_agent.c Tue Sep 9 15:15:22 2008
@@ -709,7 +709,7 @@
time(&p->start);
/* Call on this agent */
ast_verb(3, "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name);
- ast_set_connectedline(p->chan, ast->lid.lid_num, ast->lid.lid_name, ast->lid.lid_pres);
+ ast_set_connected_line(p->chan, &ast->connected.id, ast->connected.source);
ast_channel_inherit_variables(ast, p->chan);
res = ast_call(p->chan, p->loginchan, 0);
CLEANUP(ast,p);
Modified: team/group/issue8824/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_dahdi.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_dahdi.c (original)
+++ team/group/issue8824/channels/chan_dahdi.c Tue Sep 9 15:15:22 2008
@@ -2177,7 +2177,7 @@
}
p->callwaitcas = 0;
if ((p->cidspill = ast_malloc(MAX_CALLERID_SIZE))) {
- p->cidlen = ast_callerid_generate(p->cidspill, ast->lid.lid_name, ast->lid.lid_num, AST_LAW(p));
+ p->cidlen = ast_callerid_generate(p->cidspill, ast->connected.id.name, ast->connected.id.number, AST_LAW(p));
p->cidpos = 0;
send_callerid(p);
}
@@ -2218,12 +2218,12 @@
} else {
/* Call waiting call */
p->callwaitrings = 0;
- if (ast->lid.lid_num)
- ast_copy_string(p->callwait_num, ast->lid.lid_num, sizeof(p->callwait_num));
+ if (ast->connected.id.number)
+ ast_copy_string(p->callwait_num, ast->connected.id.number, sizeof(p->callwait_num));
else
p->callwait_num[0] = '\0';
- if (ast->lid.lid_name)
- ast_copy_string(p->callwait_name, ast->lid.lid_name, sizeof(p->callwait_name));
+ if (ast->connected.id.name)
+ ast_copy_string(p->callwait_name, ast->connected.id.name, sizeof(p->callwait_name));
else
p->callwait_name[0] = '\0';
/* Call waiting tone instead */
@@ -2236,8 +2236,8 @@
ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast->name);
}
- n = ast->lid.lid_name;
- l = ast->lid.lid_num;
+ n = ast->connected.id.name;
+ l = ast->connected.id.number;
if (l)
ast_copy_string(p->lastcid_num, l, sizeof(p->lastcid_num));
else
@@ -2303,14 +2303,14 @@
switch (mysig) {
case SIG_FEATD:
- l = ast->lid.lid_num;
+ l = ast->connected.id.number;
if (l)
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c);
else
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T**%s*", c);
break;
case SIG_FEATDMF:
- l = ast->lid.lid_num;
+ l = ast->connected.id.number;
if (l)
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c);
else
@@ -2423,7 +2423,7 @@
c = dest;
if (!p->hidecallerid) {
- l = ast->lid.lid_num;
+ l = ast->connected.id.number;
} else {
l = NULL;
}
@@ -2472,10 +2472,10 @@
}
}
isup_set_calling(p->ss7call, l ? (l + calling_nai_strip) : NULL, ss7_calling_nai,
- p->use_callingpres ? cid_pres2ss7pres(ast->lid.lid_pres) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
- p->use_callingpres ? cid_pres2ss7screen(ast->lid.lid_pres) : SS7_SCREENING_USER_PROVIDED );
-
- isup_set_oli(p->ss7call, ast->lid.lid_ani2);
+ p->use_callingpres ? cid_pres2ss7pres(ast->connected.id.number_presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
+ p->use_callingpres ? cid_pres2ss7screen(ast->connected.id.number_presentation) : SS7_SCREENING_USER_PROVIDED );
+
+ isup_set_oli(p->ss7call, ast->connected.ani2);
isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc);
ast_channel_lock(ast);
@@ -2553,9 +2553,9 @@
n = NULL;
if (!p->hidecallerid) {
- l = ast->lid.lid_num;
+ l = ast->connected.id.number;
if (!p->hidecalleridname) {
- n = ast->lid.lid_name;
+ n = ast->connected.id.name;
}
}
@@ -2761,7 +2761,7 @@
}
}
pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
- p->use_callingpres ? ast->lid.lid_pres : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
+ p->use_callingpres ? ast->connected.id.number_presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
if ((rr_str = pbx_builtin_getvar_helper(ast, "PRIREDIRECTREASON"))) {
if (!strcasecmp(rr_str, "UNKNOWN"))
redirect_reason = 0;
Modified: team/group/issue8824/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_features.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_features.c (original)
+++ team/group/issue8824/channels/chan_features.c Tue Sep 9 15:15:22 2008
@@ -331,12 +331,11 @@
ast_mutex_lock(&p->lock);
x = indexof(p, ast, 0);
if (!x && p->subchan) {
- p->subchan->cid.cid_num = ast_strdup(p->owner->cid.cid_num);
- p->subchan->cid.cid_name = ast_strdup(p->owner->cid.cid_name);
p->subchan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
- p->subchan->cid.cid_ani = ast_strdup(p->owner->cid.cid_ani);
-
- p->subchan->cid.cid_pres = p->owner->cid.cid_pres;
+ ast_party_redirecting_copy(&p->subchan->redirecting, &p->owner->redirecting);
+
+ ast_party_caller_copy(&p->subchan->cid, &p->owner->cid);
+
ast_string_field_set(p->subchan, language, p->owner->language);
ast_string_field_set(p->subchan, accountcode, p->owner->accountcode);
p->subchan->cdrflags = p->owner->cdrflags;
Modified: team/group/issue8824/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_h323.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_h323.c (original)
+++ team/group/issue8824/channels/chan_h323.c Tue Sep 9 15:15:22 2008
@@ -606,18 +606,18 @@
/* make sure null terminated */
called_addr[sizeof(called_addr) - 1] = '\0';
- if (c->lid.lid_num)
- ast_copy_string(pvt->options.cid_num, c->lid.lid_num, sizeof(pvt->options.cid_num));
-
- if (c->lid.lid_name)
- ast_copy_string(pvt->options.cid_name, c->lid.lid_name, sizeof(pvt->options.cid_name));
+ if (c->connected.id.number)
+ ast_copy_string(pvt->options.cid_num, c->connected.id.number, sizeof(pvt->options.cid_num));
+
+ if (c->connected.id.name)
+ ast_copy_string(pvt->options.cid_name, c->connected.id.name, sizeof(pvt->options.cid_name));
if (c->cid.cid_rdnis) {
ast_copy_string(pvt->options.cid_rdnis, c->cid.cid_rdnis, sizeof(pvt->options.cid_rdnis));
}
- pvt->options.presentation = c->lid.lid_pres;
- pvt->options.type_of_number = c->lid.lid_ton;
+ pvt->options.presentation = c->connected.id.number_presentation;
+ pvt->options.type_of_number = c->connected.id.number_type;
if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) {
if (!strcasecmp(addr, "UNKNOWN"))
Modified: team/group/issue8824/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_iax2.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_iax2.c (original)
+++ team/group/issue8824/channels/chan_iax2.c Tue Sep 9 15:15:22 2008
@@ -3646,8 +3646,8 @@
if (pds.port)
sin.sin_port = htons(atoi(pds.port));
- l = c->lid.lid_num;
- n = c->lid.lid_name;
+ l = c->connected.id.number;
+ n = c->connected.id.name;
/* Now build request */
memset(&ied, 0, sizeof(ied));
@@ -3664,21 +3664,21 @@
if (l) {
iax_ie_append_str(&ied, IAX_IE_CALLING_NUMBER, l);
- iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->lid.lid_pres);
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->connected.id.number_presentation);
} else {
if (n)
- iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->lid.lid_pres);
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->connected.id.number_presentation);
else
iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, AST_PRES_NUMBER_NOT_AVAILABLE);
}
- iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->lid.lid_ton);
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->connected.id.number_type);
iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->cid.cid_tns);
if (n)
iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, n);
- if (ast_test_flag(iaxs[callno], IAX_SENDANI) && c->lid.lid_ani)
- iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->lid.lid_ani);
+ if (ast_test_flag(iaxs[callno], IAX_SENDANI) && c->connected.ani)
+ iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->connected.ani);
if (!ast_strlen_zero(c->language))
iax_ie_append_str(&ied, IAX_IE_LANGUAGE, c->language);
@@ -4149,7 +4149,7 @@
goto done;
}
break;
- case AST_CONTROL_CONNECTEDLINE:
+ case AST_CONTROL_CONNECTED_LINE:
if (!ast_test_flag(pvt, IAX_SENDCONNECTEDLINE))
goto done;
break;
@@ -8059,9 +8059,6 @@
char caller_pref_buf[128];
struct ast_codec_pref pref;
char *using_prefs = "mine";
- char cid_num[80];
- char cid_name[80];
- int cid_pres;
/* allocate an iax_frame with 4096 bytes of data buffer */
fr = alloca(sizeof(*fr) + 4096);
@@ -9620,21 +9617,29 @@
return 1;
}
/* Don't allow connected line updates unless we are configured to */
- if (f.frametype == AST_FRAME_CONTROL && f.subclass == AST_CONTROL_CONNECTEDLINE) {
+ if (f.frametype == AST_FRAME_CONTROL && f.subclass == AST_CONTROL_CONNECTED_LINE) {
+ struct ast_party_id line_id;
+
if (!ast_test_flag(iaxs[fr->callno], IAX_RECVCONNECTEDLINE)) {
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
}
- if (!ast_parse_connectedline_data((unsigned char *) f.data.ptr, f.datalen, cid_num, sizeof(cid_num), cid_name, sizeof(cid_name), &cid_pres)) {
- ast_string_field_set(iaxs[fr->callno], cid_num, cid_num);
- ast_string_field_set(iaxs[fr->callno], cid_name, cid_name);
- iaxs[fr->callno]->calling_pres = cid_pres;
+
+ /* Initialize defaults */
+ ast_party_id_init(&line_id);
+ line_id.number_presentation = iaxs[fr->callno]->calling_pres;
+
+ if (!ast_parse_connected_line_data(f.data.ptr, f.datalen, &line_id, NULL)) {
+ ast_string_field_set(iaxs[fr->callno], cid_num, line_id.number);
+ ast_string_field_set(iaxs[fr->callno], cid_name, line_id.name);
+ iaxs[fr->callno]->calling_pres = line_id.number_presentation;
if (iaxs[fr->callno]->owner) {
- ast_set_callerid(iaxs[fr->callno]->owner, cid_num, cid_name, NULL);
- iaxs[fr->callno]->owner->cid.cid_pres = cid_pres;
+ ast_set_callerid(iaxs[fr->callno]->owner, S_OR(line_id.number, ""), S_OR(line_id.name, ""), NULL);
+ iaxs[fr->callno]->owner->cid.cid_pres = line_id.number_presentation;
}
}
+ ast_party_id_free(&line_id);
}
/* Common things */
f.src = "IAX2";
Modified: team/group/issue8824/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_local.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_local.c (original)
+++ team/group/issue8824/channels/chan_local.c Tue Sep 9 15:15:22 2008
@@ -501,17 +501,13 @@
* Note that cid_num and cid_name aren't passed in the ast_channel_alloc
* call, so it's done here instead.
*/
- p->chan->cid.cid_num = ast_strdup(p->owner->lid.lid_num);
- p->chan->cid.cid_name = ast_strdup(p->owner->lid.lid_name);
- p->chan->cid.cid_ani = ast_strdup(p->owner->lid.lid_ani);
p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
-
- p->chan->cid.cid_pres = p->owner->lid.lid_pres;
- p->chan->cid.cid_ton = p->owner->lid.lid_ton;
+ ast_party_redirecting_copy(&p->chan->redirecting, &p->owner->redirecting);
+
p->chan->cid.cid_tns = p->owner->cid.cid_tns;
- p->chan->cid.cid_ani2 = p->owner->lid.lid_ani2;
-
- ast_set_connectedline(p->chan, p->owner->cid.cid_num, p->owner->cid.cid_name, p->owner->cid.cid_pres);
+
+ ast_copy_connected_to_caller(&p->chan->cid, &p->owner->connected);
+ ast_copy_caller_to_connected(&p->chan->connected, &p->owner->cid);
ast_string_field_set(p->chan, language, p->owner->language);
ast_string_field_set(p->chan, accountcode, p->owner->accountcode);
Modified: team/group/issue8824/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_mgcp.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_mgcp.c (original)
+++ team/group/issue8824/channels/chan_mgcp.c Tue Sep 9 15:15:22 2008
@@ -916,7 +916,7 @@
transmit_modify_request(sub->next);
}
- transmit_notify_request_with_callerid(sub, tone, ast->lid.lid_num, ast->lid.lid_name);
+ transmit_notify_request_with_callerid(sub, tone, ast->connected.id.number, ast->connected.id.name);
ast_setstate(ast, AST_STATE_RINGING);
if (sub->next->owner && !ast_strlen_zero(sub->next->cxident) && !ast_strlen_zero(sub->next->callid)) {
Modified: team/group/issue8824/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_misdn.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_misdn.c (original)
+++ team/group/issue8824/channels/chan_misdn.c Tue Sep 9 15:15:22 2008
@@ -2476,10 +2476,19 @@
ast_set_callerid(ast, bc->caller.number, NULL, bc->caller.number);
- if ( !ast_strlen_zero(bc->redirecting.number) ) {
+ if (!ast_strlen_zero(bc->redirecting.number)) {
if (ast->cid.cid_rdnis)
ast_free(ast->cid.cid_rdnis);
ast->cid.cid_rdnis = ast_strdup(bc->redirecting.number);
+
+ //! \todo XXX Need to convert the mISDN number type to Q.931 number type/plan
+ //ast->redirecting.from.number_type = misdn_type_to_ast_type(bc->redirecting.number_type)
+ // | misdn_plan_to_ast_plan(bc->redirecting.plan);
+ ast->redirecting.from.number_presentation =
+ misdn_pres_to_ast_pres(bc->redirecting.presentation)
+ | misdn_screen_to_ast_screen(bc->redirecting.screening);
+ // Also need a redirecting reason parameter.
+ //ast->redirecting.reason = bc->redirecting_reason;
}
misdn_cfg_get(bc->port, MISDN_CFG_OVERLAP_DIAL, &ch->overlap_dial, sizeof(ch->overlap_dial));
@@ -2518,21 +2527,33 @@
*
* \param ast Current Asterisk channel
* \param bc Associated B channel
- * \param data Asterisk indication data buffer frame containing the new connected line data
- * \param datalen Length of the data buffer frame
*
* \return Nothing
*/
-static void misdn_update_connectedline(struct ast_channel *ast, struct misdn_bchannel *bc, const void *data, size_t datalen)
-{
- char lid_number[sizeof(bc->connected.number)];
- char lid_name[80];
- int lid_pres;
-
- strcpy(bc->connected.number, ast->lid.lid_number);
- bc->connected.presentation = ast_pres_to_misdn_pres(ast->lid.lid_pres);
- bc->connected.screening = ast_screen_to_misdn_screen(ast->lid.lid_pres);
+static void misdn_update_connectedline(struct ast_channel *ast, struct misdn_bchannel *bc)
+{
+ ast_copy_string(bc->connected.number, ast->connected.id.number, sizeof(bc->connected.number));
+ bc->connected.presentation = ast_pres_to_misdn_pres(ast->connected.id.number_presentation);
+ bc->connected.screening = ast_screen_to_misdn_screen(ast->connected.id.number_presentation);
} /* end misdn_update_connectedline() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Notify peer that the redirecting info has changed.
+ *
+ * \param ast Current Asterisk channel
+ * \param bc Associated B channel
+ *
+ * \return Nothing
+ */
+static void misdn_update_redirecting(struct ast_channel *ast, struct misdn_bchannel *bc)
+{
+ /*! \todo BUGBUG misdn_update_redirecting() not written */
+} /* end misdn_update_redirecting() */
/*****************************/
@@ -2636,8 +2657,8 @@
newbc->caller.presentation = newbc->presentation;
}
- /*
- * XXX We should be getting all of the redirect parameters from the asterisk channel
+ /*!
+ * \todo XXX We should be getting all of the redirect parameters from the asterisk channel
* but its not supported now.
* Also need a redirecting reason parameter.
*/
@@ -2920,9 +2941,13 @@
ast_moh_stop(ast);
chan_misdn_log(1, p->bc->port, " --> *\tUNHOLD pid:%d\n", p->bc->pid);
break;
- case AST_CONTROL_CONNECTEDLINE:
+ case AST_CONTROL_CONNECTED_LINE:
chan_misdn_log(1, p->bc->port, "* IND :\tconnected line update pid:%d\n", p->bc->pid);
- misdn_update_connectedline(ast, p->bc, data, datalen);
+ misdn_update_connectedline(ast, p->bc);
+ break;
+ case AST_CONTROL_REDIRECTING:
+ chan_misdn_log(1, p->bc->port, "* IND :\tredirecting info update pid:%d\n", p->bc->pid);
+ misdn_update_redirecting(ast, p->bc);
break;
default:
chan_misdn_log(1, p->bc->port, " --> * Unknown Indication:%d pid:%d\n", cond, p->bc->pid);
@@ -4957,11 +4982,16 @@
bridged_ch->bc->connected = bc->connected;
}
} else {
- int lid_pres;
-
- lid_pres = misdn_pres_to_ast_pres(bc->connected.presentation)
+ int presentation;
+ struct ast_party_id line_id;
+
+ ast_party_id_init(&line_id);
+ presentation = misdn_pres_to_ast_pres(bc->connected.presentation)
| misdn_screen_to_ast_screen(bc->connected.screening);
- ast_queue_connectedline_update(ch->ast, bc->connected.number, NULL, lid_pres);
+ line_id.number = bc->connected.number;
+ line_id.number_type = bc->connected.number_type;
+ line_id.number_presentation = presentation;
+ ast_queue_connected_line_update(ch->ast, &line_id, 0 /*! \todo XXX Need an answer value to put here */);
}
ch->l3id=bc->l3_id;
Modified: team/group/issue8824/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_phone.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_phone.c (original)
+++ team/group/issue8824/channels/chan_phone.c Tue Sep 9 15:15:22 2008
@@ -303,13 +303,13 @@
snprintf(cid.min, sizeof(cid.min), "%02d", tm.tm_min);
}
/* the standard format of ast->callerid is: "name" <number>, but not always complete */
- if (ast_strlen_zero(ast->lid.lid_name))
+ if (ast_strlen_zero(ast->connected.id.name))
strcpy(cid.name, DEFAULT_CALLER_ID);
else
- ast_copy_string(cid.name, ast->lid.lid_name, sizeof(cid.name));
-
- if (ast->lid.lid_num)
- ast_copy_string(cid.number, ast->lid.lid_num, sizeof(cid.number));
+ ast_copy_string(cid.name, ast->connected.id.name, sizeof(cid.name));
+
+ if (ast->connected.id.number)
+ ast_copy_string(cid.number, ast->connected.id.number, sizeof(cid.number));
p = ast->tech_pvt;
Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=142276&r1=142275&r2=142276
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Tue Sep 9 15:15:22 2008
@@ -5474,7 +5474,7 @@
case AST_CONTROL_SRCUPDATE:
ast_rtp_new_source(p->rtp);
break;
- case AST_CONTROL_CONNECTEDLINE:
+ case AST_CONTROL_CONNECTED_LINE:
update_connectedline(p, data, datalen);
break;
case -1:
@@ -8065,11 +8065,11 @@
const char *privacy = NULL;
const char *screen = NULL;
- if (p->owner && p->owner->lid.lid_num)
- lid_num = p->owner->lid.lid_num;
- if (p->owner && p->owner->lid.lid_name)
- lid_name = p->owner->lid.lid_name;
- lid_pres = (p->owner) ? p->owner->lid.lid_pres : AST_PRES_NUMBER_NOT_AVAILABLE;
+ if (p->owner && p->owner->connected.id.number)
+ lid_num = p->owner->connected.id.number;
+ if (p->owner && p->owner->connected.id.name)
+ lid_name = p->owner->connected.id.name;
+ lid_pres = (p->owner) ? p->owner->connected.id.number_presentation : AST_PRES_NUMBER_NOT_AVAILABLE;
if (ast_strlen_zero(lid_num))
return 0;
@@ -8946,9 +8946,9 @@
snprintf(p->lastmsg, sizeof(p->lastmsg), "Init: %s", sip_methods[sipmethod].text);
- if (p->owner && (p->owner->lid.lid_pres & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
- l = p->owner->lid.lid_num;
- n = p->owner->lid.lid_name;
+ if (p->owner && (p->owner->connected.id.number_presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
+ l = p->owner->connected.id.number;
+ n = p->owner->connected.id.name;
}
if (ast_strlen_zero(l))
l = default_callerid;
@@ -9516,10 +9516,10 @@
if (!ast_test_flag(&p->flags[0], SIP_SENDRPID))
return;
- if (ast_strlen_zero(p->owner->lid.lid_num))
+ if (ast_strlen_zero(p->owner->connected.id.number))
return;
- append_history(p, "ConnectedLine", "%s party is now %s <%s>", ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "Calling" : "Called", p->owner->lid.lid_name, p->owner->lid.lid_num);
+ append_history(p, "ConnectedLine", "%s party is now %s <%s>", ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "Calling" : "Called", p->owner->connected.id.name, p->owner->connected.id.number);
if (p->owner->_state == AST_STATE_UP || ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
struct sip_request req;
@@ -15244,7 +15244,8 @@
struct ast_channel *bridgepeer = NULL;
char *p_hdrval;
int rtn;
-
+ struct ast_party_id line_id;
+
if (reinvite)
ast_debug(4, "SIP response %d to RE-invite on %s call %s\n", resp, outgoing ? "outgoing" : "incoming", p->callid);
else
@@ -15291,7 +15292,11 @@
ast_log(LOG_WARNING, "Unable to cancel SIP destruction. Expect bad things.\n");
if (!req->ignore && p->owner) {
if (get_rpid(p, req)) {
- ast_queue_connectedline_update(p->owner, p->cid_num, p->cid_name, p->callingpres);
+ ast_party_id_init(&line_id);
+ line_id.number = (char *) p->cid_num;
+ line_id.name = (char *) p->cid_name;
+ line_id.number_presentation = p->callingpres;
+ ast_queue_connected_line_update(p->owner, &line_id, 0 /*! \todo XXX Need an answer value to put here */);
}
ast_queue_control(p->owner, AST_CONTROL_RINGING);
if (p->owner->_state != AST_STATE_UP) {
@@ -15317,7 +15322,11 @@
if (!req->ignore && p->owner) {
if (get_rpid(p, req)) {
/* Queue a connected line update */
- ast_queue_connectedline_update(p->owner, p->cid_num, p->cid_name, p->callingpres);
+ ast_party_id_init(&line_id);
+ line_id.number = (char *) p->cid_num;
+ line_id.name = (char *) p->cid_name;
+ line_id.number_presentation = p->callingpres;
+ ast_queue_connected_line_update(p->owner, &line_id, 0 /*! \todo XXX Need an answer value to put here */);
}
}
if (find_sdp(req)) {
@@ -17168,7 +17177,7 @@
/*! \brief Handle incoming INVITE request
\note If the INVITE has a Replaces header, it is part of an
* attended transfer. If so, we do not go through the dial
- * plan but tries to find the active call and masquerade
+ * plan but try to find the active call and masquerade
* into it
*/
static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e, int *nounlock)
@@ -17403,8 +17412,15 @@
parse_ok_contact(p, req);
} else { /* Re-invite on existing call */
ast_clear_flag(&p->flags[0], SIP_OUTGOING); /* This is now an inbound dialog */
- if (get_rpid(p, req))
- ast_queue_connectedline_update(p->owner, p->cid_num, p->cid_name, p->callingpres);
+ if (get_rpid(p, req)) {
+ struct ast_party_id line_id;
+
+ ast_party_id_init(&line_id);
+ line_id.number = (char *) p->cid_num;
+ line_id.name = (char *) p->cid_name;
+ line_id.number_presentation = p->callingpres;
+ ast_queue_connected_line_update(p->owner, &line_id, 0 /*! \todo XXX Need a transfer value to put here */);
+ }
/* Handle SDP here if we already have an owner */
if (find_sdp(req)) {
if (process_sdp(p, req, SDP_T38_INITIATE)) {
@@ -17937,6 +17953,8 @@
else
ast_clear_flag(&transferer->flags[0], SIP_DEFER_BYE_ON_TRANSFER);
} else {
+ struct ast_party_id caller_id;
+
/* Transfer succeeded! */
/* Tell transferer that we're done. */
@@ -17950,13 +17968,16 @@
if (target.chan2) {
/* Tell each of the other channels to whom they are now connected */
- ast_connectedline_update(target.chan2, current->chan2->cid.cid_num, current->chan2->cid.cid_name, current->chan2->cid.cid_pres);
- ast_connectedline_update(current->chan2, target.chan2->cid.cid_num, target.chan2->cid.cid_name, target.chan2->cid.cid_pres);
+ ast_party_id_collect_caller_id(&caller_id, ¤t->chan2->cid);
+ ast_connected_line_update(target.chan2, &caller_id, 0 /*! \todo XXX Need a transfer value to put here */);
+ ast_party_id_collect_caller_id(&caller_id, &target.chan2->cid);
+ ast_connected_line_update(current->chan2, &caller_id, 0 /*! \todo XXX Need a transfer value to put here */);
} else {
/* Notify the first other party that they are connected to someone else assuming that target.chan1
has progressed far enough through the dialplan to have it's called party information set. */
- if (current->chan2)
- ast_connectedline_update(current->chan2, target.chan1->lid.lid_num, target.chan1->lid.lid_name, target.chan1->lid.lid_pres);
[... 2083 lines stripped ...]
More information about the asterisk-commits
mailing list