aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_dahdi.c10
-rw-r--r--channels/chan_local.c3
-rw-r--r--channels/chan_misdn.c62
-rw-r--r--channels/chan_sip.c45
-rw-r--r--channels/misdn/chan_misdn_config.h2
-rw-r--r--channels/misdn/isdn_lib.h5
-rw-r--r--channels/misdn_config.c7
-rw-r--r--channels/sip/include/sip.h2
8 files changed, 117 insertions, 19 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index b072d86ce..d8e7496ce 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -1049,6 +1049,11 @@ struct dahdi_pvt {
int cid_ani2;
/*! \brief Caller ID number from an incoming call. */
char cid_num[AST_MAX_EXTENSION];
+ /*!
+ * \brief Caller ID tag from incoming call
+ * \note the "cid_tag" string read in from chan_dahdi.conf
+ */
+ char cid_tag[AST_MAX_EXTENSION];
/*! \brief Caller ID Q.931 TON/NPI field values. Set by PRI. Zero otherwise. */
int cid_ton;
/*! \brief Caller ID name from an incoming call. */
@@ -1386,6 +1391,7 @@ static struct dahdi_chan_conf dahdi_chan_conf_default(void)
.context = "default",
.cid_num = "",
.cid_name = "",
+ .cid_tag = "",
.mohinterpret = "default",
.mohsuggest = "",
.parkinglot = "",
@@ -9024,6 +9030,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
tmp->cid.cid_pres = i->callingpres;
tmp->cid.cid_ton = i->cid_ton;
tmp->cid.cid_ani2 = i->cid_ani2;
+ tmp->cid.cid_tag = ast_strdup(i->cid_tag);
#if defined(HAVE_SS7)
tmp->transfercapability = transfercapability;
pbx_builtin_setvar_helper(tmp, "TRANSFERCAPABILITY", ast_transfercapability2str(transfercapability));
@@ -11995,6 +12002,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
tmp->cid_num[0] = '\0';
tmp->cid_name[0] = '\0';
}
+ ast_copy_string(tmp->cid_tag, conf->chan.cid_tag, sizeof(tmp->cid_tag));
tmp->cid_subaddr[0] = '\0';
ast_copy_string(tmp->mailbox, conf->chan.mailbox, sizeof(tmp->mailbox));
if (channel != CHAN_PSEUDO && !ast_strlen_zero(tmp->mailbox)) {
@@ -16781,6 +16789,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
ast_copy_string(confp->chan.cid_name, v->value, sizeof(confp->chan.cid_name));
} else if (!strcasecmp(v->name, "cid_number")) {
ast_copy_string(confp->chan.cid_num, v->value, sizeof(confp->chan.cid_num));
+ } else if (!strcasecmp(v->name, "cid_tag")) {
+ ast_copy_string(confp->chan.cid_tag, v->value, sizeof(confp->chan.cid_tag));
} else if (!strcasecmp(v->name, "useincomingcalleridondahditransfer")) {
confp->chan.dahditrcallerid = ast_true(v->value);
} else if (!strcasecmp(v->name, "restrictcid")) {
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 337aadc7c..1f09c9cb5 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -433,6 +433,9 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da
if (the_other_channel) {
unsigned char frame_data[1024];
if (condition == AST_CONTROL_CONNECTED_LINE) {
+ if (isoutbound) {
+ ast_connected_line_copy_to_caller(&the_other_channel->cid, &this_channel->connected);
+ }
f.datalen = ast_connected_line_build_data(frame_data, sizeof(frame_data), &this_channel->connected);
} else {
f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), &this_channel->redirecting);
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index f363c7c13..082373d97 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -5978,6 +5978,10 @@ static int read_config(struct chan_list *ch)
ast_mutex_init(&ch->overlap_tv_lock);
} /* ORIG MISDN END */
+ misdn_cfg_get(port, MISDN_CFG_INCOMING_CALLERID_TAG, bc->incoming_cid_tag, sizeof(bc->incoming_cid_tag));
+ if (!ast_strlen_zero(bc->incoming_cid_tag)) {
+ chan_misdn_log(1, port, " --> * Setting incoming caller id tag to \"%s\"\n", bc->incoming_cid_tag);
+ }
ch->overlap_dial_task = -1;
if (ch->faxdetect || ch->ast_dsp) {
@@ -6003,10 +6007,11 @@ static int read_config(struct chan_list *ch)
* \param ast Current Asterisk channel
* \param id Party id information to send to the other side
* \param source Why are we sending this update
+ * \param cid_tag Caller ID tag to set in the connected line
*
* \return Nothing
*/
-static void misdn_queue_connected_line_update(struct ast_channel *ast, const struct misdn_party_id *id, enum AST_CONNECTED_LINE_UPDATE_SOURCE source)
+static void misdn_queue_connected_line_update(struct ast_channel *ast, const struct misdn_party_id *id, enum AST_CONNECTED_LINE_UPDATE_SOURCE source, char *cid_tag)
{
struct ast_party_connected_line connected;
@@ -6016,6 +6021,7 @@ static void misdn_queue_connected_line_update(struct ast_channel *ast, const str
| misdn_to_ast_plan(id->number_plan);
connected.id.number_presentation = misdn_to_ast_pres(id->presentation)
| misdn_to_ast_screen(id->screening);
+ connected.id.tag = cid_tag;
connected.source = source;
ast_channel_queue_connected_line_update(ast, &connected);
}
@@ -6168,10 +6174,11 @@ static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct as
*
* \param ast Current Asterisk channel
* \param redirect Associated B channel redirecting info
+ * \param tag Caller ID tag to set in the redirecting party fields
*
* \return Nothing
*/
-static void misdn_copy_redirecting_to_ast(struct ast_channel *ast, const struct misdn_party_redirecting *redirect)
+static void misdn_copy_redirecting_to_ast(struct ast_channel *ast, const struct misdn_party_redirecting *redirect, char *tag)
{
struct ast_party_redirecting redirecting;
@@ -6184,6 +6191,7 @@ static void misdn_copy_redirecting_to_ast(struct ast_channel *ast, const struct
redirecting.from.number_presentation =
misdn_to_ast_pres(redirect->from.presentation)
| misdn_to_ast_screen(redirect->from.screening);
+ redirecting.from.tag = tag;
redirecting.to.number = (char *) redirect->to.number;
redirecting.to.number_type =
@@ -6192,6 +6200,7 @@ static void misdn_copy_redirecting_to_ast(struct ast_channel *ast, const struct
redirecting.to.number_presentation =
misdn_to_ast_pres(redirect->to.presentation)
| misdn_to_ast_screen(redirect->to.screening);
+ redirecting.to.tag = tag;
redirecting.reason = misdn_to_ast_reason(redirect->reason);
redirecting.count = redirect->count;
@@ -6281,6 +6290,7 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
struct chan_list *ch;
struct misdn_bchannel *newbc;
char *dest_cp;
+ int append_msn = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(intf); /* The interface token is discarded. */
@@ -6392,6 +6402,14 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number);
}
+ misdn_cfg_get(port, MISDN_CFG_APPEND_MSN_TO_CALLERID_TAG, &append_msn, sizeof(append_msn));
+ if (append_msn) {
+ strncat(newbc->incoming_cid_tag, "_", sizeof(newbc->incoming_cid_tag) - strlen(newbc->incoming_cid_tag) - 1);
+ strncat(newbc->incoming_cid_tag, newbc->caller.number, sizeof(newbc->incoming_cid_tag) - strlen(newbc->incoming_cid_tag) - 1);
+ }
+
+ ast->cid.cid_tag = ast_strdup(newbc->incoming_cid_tag);
+
misdn_cfg_get(port, MISDN_CFG_LOCALDIALPLAN, &number_type, sizeof(number_type));
if (number_type < 0) {
newbc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number_type);
@@ -8791,7 +8809,7 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel
++bc->redirecting.count;
bc->redirecting.reason = mISDN_REDIRECTING_REASON_DEFLECTION;
- misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting);
+ misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag);
ast_string_field_set(ch->ast, call_forward, bc->redirecting.to.number);
/* Send back positive ACK */
@@ -8855,7 +8873,7 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel
bc->redirecting.to.presentation = 1;/* restricted */
bc->redirecting.to.screening = 0;/* unscreened */
}
- misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting);
+ misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag);
bc->div_leg_3_rx_wanted = 1;
}
break;
@@ -8900,7 +8918,7 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel
/* We have no place to put the OriginalCalled number */
}
#endif
- misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting);
+ misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag);
}
break;
default:
@@ -8950,7 +8968,7 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel
++bc->redirecting.count;
bc->redirecting.reason = mISDN_REDIRECTING_REASON_DEFLECTION;
- misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting);
+ misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag);
ast_string_field_set(ch->ast, call_forward, bc->redirecting.to.number);
misdn_lib_send_event(bc, EVENT_DISCONNECT);
@@ -9072,7 +9090,8 @@ static void misdn_facility_ie_handler(enum event_e event, struct misdn_bchannel
misdn_queue_connected_line_update(ch->ast, &party_id,
(bc->fac_in.u.EctInform.Status == 0 /* alerting */)
? AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING
- : AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER);
+ : AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER,
+ bc->incoming_cid_tag);
}
break;
#if 0 /* We don't handle this yet */
@@ -9707,6 +9726,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
int exceed;
int ai;
int im;
+ int append_msn = 0;
if (ch) {
switch (ch->state) {
@@ -9780,12 +9800,22 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ast_set_callerid(chan, bc->caller.number, NULL, bc->caller.number);
+ misdn_cfg_get(bc->port, MISDN_CFG_APPEND_MSN_TO_CALLERID_TAG, &append_msn, sizeof(append_msn));
+ if (append_msn) {
+ strncat(bc->incoming_cid_tag, "_", sizeof(bc->incoming_cid_tag) - strlen(bc->incoming_cid_tag) - 1);
+ strncat(bc->incoming_cid_tag, bc->dialed.number, sizeof(bc->incoming_cid_tag) - strlen(bc->incoming_cid_tag) - 1);
+ }
+
+ ast_channel_lock(chan);
+ chan->cid.cid_tag = ast_strdup(bc->incoming_cid_tag);
+ ast_channel_unlock(chan);
+
if (!ast_strlen_zero(bc->redirecting.from.number)) {
/* Add configured prefix to redirecting.from.number */
misdn_add_number_prefix(bc->port, bc->redirecting.from.number_type, bc->redirecting.from.number, sizeof(bc->redirecting.from.number));
/* Update asterisk channel redirecting information */
- misdn_copy_redirecting_to_ast(chan, &bc->redirecting);
+ misdn_copy_redirecting_to_ast(chan, &bc->redirecting, bc->incoming_cid_tag);
}
pbx_builtin_setvar_helper(chan, "TRANSFERCAPABILITY", ast_transfercapability2str(bc->capability));
@@ -10124,11 +10154,13 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
}
#endif /* defined(AST_MISDN_ENHANCEMENTS) */
- /* Add configured prefix to connected.number */
- misdn_add_number_prefix(bc->port, bc->connected.number_type, bc->connected.number, sizeof(bc->connected.number));
+ if (!ast_strlen_zero(bc->connected.number)) {
+ /* Add configured prefix to connected.number */
+ misdn_add_number_prefix(bc->port, bc->connected.number_type, bc->connected.number, sizeof(bc->connected.number));
- /* Update the connected line information on the other channel */
- misdn_queue_connected_line_update(ch->ast, &bc->connected, AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER);
+ /* Update the connected line information on the other channel */
+ misdn_queue_connected_line_update(ch->ast, &bc->connected, AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER, bc->incoming_cid_tag);
+ }
ch->l3id = bc->l3_id;
ch->addr = bc->addr;
@@ -10511,7 +10543,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
bc->redirecting.reason = mISDN_REDIRECTING_REASON_UNKNOWN;
break;
}
- misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting);
+ misdn_copy_redirecting_to_ast(ch->ast, &bc->redirecting, bc->incoming_cid_tag);
ast_channel_queue_redirecting_update(ch->ast, &ch->ast->redirecting);
}
}
@@ -10530,7 +10562,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
bc->redirecting.to_changed = 0;
if (ch && ch->ast) {
misdn_queue_connected_line_update(ch->ast, &bc->redirecting.to,
- AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING);
+ AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING, bc->incoming_cid_tag);
}
}
break;
@@ -10539,7 +10571,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
bc->redirecting.to_changed = 0;
if (ch && ch->ast) {
misdn_queue_connected_line_update(ch->ast, &bc->redirecting.to,
- AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER);
+ AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER, bc->incoming_cid_tag);
}
}
break;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6fe3e1c6f..d0a876659 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4741,6 +4741,7 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
ast_string_field_set(dialog, context, peer->context);
ast_string_field_set(dialog, cid_num, peer->cid_num);
ast_string_field_set(dialog, cid_name, peer->cid_name);
+ ast_string_field_set(dialog, cid_tag, peer->cid_tag);
ast_string_field_set(dialog, mwi_from, peer->mwi_from);
ast_string_field_set(dialog, parkinglot, peer->parkinglot);
ast_string_field_set(dialog, engine, peer->engine);
@@ -6281,6 +6282,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
ast_channel_lock(tmp);
sip_pvt_lock(i);
ast_channel_cc_params_init(tmp, i->cc_params);
+ tmp->cid.cid_tag = ast_strdup(i->cid_tag);
ast_channel_unlock(tmp);
tmp->tech = ( ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_INFO || ast_test_flag(&i->flags[0], SIP_DTMF) == SIP_DTMF_SHORTINFO) ? &sip_tech_info : &sip_tech;
@@ -13395,7 +13397,11 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq, char **name, c
params++;
/* Check if we have a reason parameter */
if ((reason_param = strcasestr(params, "reason="))) {
+ char *end;
reason_param+=7;
+ if ((end = strchr(reason_param, ';'))) {
+ *end = '\0';
+ }
/* Remove enclosing double-quotes */
if (*reason_param == '"')
ast_strip_quoted(reason_param, "\"", "\"");
@@ -14118,6 +14124,8 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of,
}
if (!ast_strlen_zero(peer->cid_name))
ast_string_field_set(p, cid_name, peer->cid_name);
+ if (!ast_strlen_zero(peer->cid_tag))
+ ast_string_field_set(p, cid_tag, peer->cid_tag);
if (peer->callingpres)
p->callingpres = peer->callingpres;
}
@@ -17527,6 +17535,7 @@ static void change_redirecting_information(struct sip_pvt *p, struct sip_request
ast_debug(3, "Got redirecting from name %s\n", redirecting_from_name);
redirecting->from.name = redirecting_from_name;
}
+ redirecting->from.tag = (char *) p->cid_tag;
if (!ast_strlen_zero(redirecting_to_number)) {
if (redirecting->to.number) {
ast_free(redirecting->to.number);
@@ -17541,6 +17550,7 @@ static void change_redirecting_information(struct sip_pvt *p, struct sip_request
ast_debug(3, "Got redirecting to name %s\n", redirecting_from_number);
redirecting->to.name = redirecting_to_name;
}
+ redirecting->to.tag = (char *) p->cid_tag;
redirecting->reason = reason;
}
@@ -17888,6 +17898,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
ast_party_connected_line_init(&connected);
connected.id.number = (char *) p->cid_num;
connected.id.name = (char *) p->cid_name;
+ connected.id.tag = (char *) p->cid_tag;
connected.id.number_presentation = p->callingpres;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(p->owner, &connected);
@@ -17932,6 +17943,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
ast_party_connected_line_init(&connected);
connected.id.number = (char *) p->cid_num;
connected.id.name = (char *) p->cid_name;
+ connected.id.tag = (char *) p->cid_tag;
connected.id.number_presentation = p->callingpres;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(p->owner, &connected);
@@ -17977,6 +17989,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest
ast_party_connected_line_init(&connected);
connected.id.number = (char *) p->cid_num;
connected.id.name = (char *) p->cid_name;
+ connected.id.tag = (char *) p->cid_tag;
connected.id.number_presentation = p->callingpres;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(p->owner, &connected);
@@ -20121,6 +20134,7 @@ static int handle_request_update(struct sip_pvt *p, struct sip_request *req)
ast_party_connected_line_init(&connected);
connected.id.number = (char *) p->cid_num;
connected.id.name = (char *) p->cid_name;
+ connected.id.tag = (char *) p->cid_tag;
connected.id.number_presentation = p->callingpres;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
ast_channel_queue_connected_line_update(p->owner, &connected);
@@ -20448,6 +20462,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
ast_party_connected_line_init(&connected);
connected.id.number = (char *) p->cid_num;
connected.id.name = (char *) p->cid_name;
+ connected.id.tag = (char *) p->cid_tag;
connected.id.number_presentation = p->callingpres;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
ast_channel_queue_connected_line_update(p->owner, &connected);
@@ -21073,11 +21088,30 @@ static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *
ast_channel_queue_connected_line_update(target.chan2, &connected_to_target);
} else {
/* Since target.chan1 isn't actually connected to another channel, there is no way for us
- * to queue a frame so that its connected line status will be updated. Instead, we have to
- * change it directly. Since we are not the channel thread, we cannot run a connected line
- * interception macro on target.chan1
+ * to queue a frame so that its connected line status will be updated.
+ *
+ * Instead, we use the somewhat hackish approach of using a special control frame type that
+ * instructs ast_read to perform a specific action. In this case, the frame we queue tells
+ * ast_read to call the connected line interception macro configured for target.chan1.
+ */
+ struct ast_control_read_action_payload *frame_payload;
+ int payload_size;
+ int frame_size;
+ unsigned char connected_line_data[1024];
+ payload_size = ast_connected_line_build_data(connected_line_data, sizeof(connected_line_data), &connected_to_target);
+ frame_size = payload_size + sizeof(*frame_payload);
+ if (payload_size != -1 && (frame_payload = alloca(frame_size))) {
+ frame_payload->payload_size = payload_size;
+ memcpy(frame_payload->payload, connected_line_data, payload_size);
+ frame_payload->action = AST_FRAME_READ_ACTION_CONNECTED_LINE_MACRO;
+ ast_queue_control_data(target.chan1, AST_CONTROL_READ_ACTION, frame_payload, frame_size);
+ }
+ /* In addition to queueing the read action frame so that target.chan1's connected line info
+ * will be updated, we also are going to queue a plain old connected line update on target.chan1. This
+ * way, either Dial or Queue can apply this connected line update to the outgoing ringing channel.
*/
- ast_channel_update_connected_line(target.chan1, &connected_to_target);
+ ast_channel_queue_connected_line_update(target.chan1, &connected_to_transferee);
+
}
ast_channel_unref(current->chan1);
}
@@ -24718,6 +24752,7 @@ static void set_peer_defaults(struct sip_peer *peer)
ast_string_field_set(peer, md5secret, "");
ast_string_field_set(peer, cid_num, "");
ast_string_field_set(peer, cid_name, "");
+ ast_string_field_set(peer, cid_tag, "");
ast_string_field_set(peer, fromdomain, "");
ast_string_field_set(peer, fromuser, "");
ast_string_field_set(peer, regexten, "");
@@ -24933,6 +24968,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
ast_string_field_set(peer, cid_name, "");
} else if (!strcasecmp(v->name, "cid_number")) {
ast_string_field_set(peer, cid_num, v->value);
+ } else if (!strcasecmp(v->name, "cid_tag")) {
+ ast_string_field_set(peer, cid_tag, v->value);
} else if (!strcasecmp(v->name, "context")) {
ast_string_field_set(peer, context, v->value);
ast_set_flag(&peer->flags[1], SIP_PAGE2_HAVEPEERCONTEXT);
diff --git a/channels/misdn/chan_misdn_config.h b/channels/misdn/chan_misdn_config.h
index e1fe16766..270b505ba 100644
--- a/channels/misdn/chan_misdn_config.h
+++ b/channels/misdn/chan_misdn_config.h
@@ -42,6 +42,8 @@ enum misdn_cfg_elements {
MISDN_CFG_LANGUAGE, /* char[] */
MISDN_CFG_MUSICCLASS, /* char[] */
MISDN_CFG_CALLERID, /* char[] */
+ MISDN_CFG_INCOMING_CALLERID_TAG, /* char[] */
+ MISDN_CFG_APPEND_MSN_TO_CALLERID_TAG, /* int (bool) */
MISDN_CFG_METHOD, /* char[] */
MISDN_CFG_DIALPLAN, /* int */
MISDN_CFG_LOCALDIALPLAN, /* int */
diff --git a/channels/misdn/isdn_lib.h b/channels/misdn/isdn_lib.h
index 89565327e..a04476068 100644
--- a/channels/misdn/isdn_lib.h
+++ b/channels/misdn/isdn_lib.h
@@ -349,6 +349,11 @@ struct misdn_bchannel {
*/
struct misdn_party_id caller;
+ /*! \brief Incoming Caller ID string tag for special purpose
+ * \note The element can be set to "incoming_cid_tag" in /etc/asterisk/misdn.conf for incoming calls
+ */
+ char incoming_cid_tag[MISDN_MAX_NAME_LEN];
+
/*! \brief Connected-Party/Connected-Line ID information struct
* \note The number_type element can be set to "cpndialplan" in /etc/asterisk/misdn.conf for outgoing calls
*/
diff --git a/channels/misdn_config.c b/channels/misdn_config.c
index 82d3547f7..e14f2adee 100644
--- a/channels/misdn_config.c
+++ b/channels/misdn_config.c
@@ -134,6 +134,13 @@ static const struct misdn_cfg_spec port_spec[] = {
"Sets the musiconhold class." },
{ "callerid", MISDN_CFG_CALLERID, MISDN_CTYPE_STR, "", NONE,
"Set the outgoing caller id to the value." },
+ { "incoming_cid_tag", MISDN_CFG_INCOMING_CALLERID_TAG, MISDN_CTYPE_STR, "", NONE,
+ "Set the incoming caller id string tag to the value." },
+ { "append_msn_to_cid_tag", MISDN_CFG_APPEND_MSN_TO_CALLERID_TAG, MISDN_CTYPE_BOOL, "no", NONE,
+ "Automatically appends incoming or outgoing MSN to the incoming caller\n"
+ "\tid string tag. An underscore '_' is used as delimiter. Incoming calls\n"
+ "\twill have the dialed number appended, and outgoing calls will have the\n"
+ "\tcaller number appended to the tag." },
{ "method", MISDN_CFG_METHOD, MISDN_CTYPE_STR, "standard", NONE,
"Set the method to use for channel selection:\n"
"\t standard - Use the first free channel starting from the lowest number.\n"
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index 2ee19b6d7..ade534ede 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -926,6 +926,7 @@ struct sip_pvt {
AST_STRING_FIELD(peermd5secret);
AST_STRING_FIELD(cid_num); /*!< Caller*ID number */
AST_STRING_FIELD(cid_name); /*!< Caller*ID name */
+ AST_STRING_FIELD(cid_tag); /*!< Caller*ID tag */
AST_STRING_FIELD(mwi_from); /*!< Name to place in the From header in outgoing NOTIFY requests */
AST_STRING_FIELD(fullcontact); /*!< The Contact: that the UA registers with us */
/* we only store the part in <brackets> in this field. */
@@ -1130,6 +1131,7 @@ struct sip_peer {
AST_STRING_FIELD(fullcontact); /*!< Contact registered with us (not in sip.conf) */
AST_STRING_FIELD(cid_num); /*!< Caller ID num */
AST_STRING_FIELD(cid_name); /*!< Caller ID name */
+ AST_STRING_FIELD(cid_tag); /*!< Caller ID tag */
AST_STRING_FIELD(vmexten); /*!< Dialplan extension for MWI notify message*/
AST_STRING_FIELD(language); /*!< Default language for prompts */
AST_STRING_FIELD(mohinterpret); /*!< Music on Hold class */