diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-06 17:14:15 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-06 17:14:15 +0000 |
commit | d17e64fbd448257f32d3ff01e6b8acf5c0e90e7d (patch) | |
tree | 20b7e592d6b3e6feaa109408a3cb26496002bb7f /channels/chan_sip.c | |
parent | 6a45c6ef5561bbbd9c4bb7ace6ddfdd58cb38560 (diff) |
Some clients do not put the call-id for replaces at the beginning, so support it being anywhere in the string.
(closes issue #14350)
Reported by: fhackenberger
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@173967 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index db6973bb0..ce07ecc7d 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9322,50 +9322,48 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi } /* Check for arguments in the refer_to header */ - if ((ptr = strchr(refer_to, '?'))) { /* Search for arguments */ - *ptr++ = '\0'; - if (!strncasecmp(ptr, "REPLACES=", 9)) { - char *to = NULL, *from = NULL; - - /* This is an attended transfer */ - referdata->attendedtransfer = 1; - ast_copy_string(referdata->replaces_callid, ptr+9, sizeof(referdata->replaces_callid)); - ast_uri_decode(referdata->replaces_callid); - if ((ptr = strchr(referdata->replaces_callid, ';'))) /* Find options */ { - *ptr++ = '\0'; - } - - if (ptr) { - /* Find the different tags before we destroy the string */ - to = strcasestr(ptr, "to-tag="); - from = strcasestr(ptr, "from-tag="); - } - - /* Grab the to header */ - if (to) { - ptr = to + 7; - if ((to = strchr(ptr, '&'))) - *to = '\0'; - if ((to = strchr(ptr, ';'))) - *to = '\0'; - ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag)); - } - - if (from) { - ptr = from + 9; - if ((to = strchr(ptr, '&'))) - *to = '\0'; - if ((to = strchr(ptr, ';'))) - *to = '\0'; - ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag)); - } - - if (option_debug > 1) { - if (!pedanticsipchecking) - ast_log(LOG_DEBUG,"Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid ); - else - ast_log(LOG_DEBUG,"Attended transfer: Will use Replace-Call-ID : %s F-tag: %s T-tag: %s\n", referdata->replaces_callid, referdata->replaces_callid_fromtag ? referdata->replaces_callid_fromtag : "<none>", referdata->replaces_callid_totag ? referdata->replaces_callid_totag : "<none>" ); - } + ast_log(LOG_NOTICE, "refer to = %s\n", refer_to); + if ((ptr = strcasestr(refer_to, "replaces="))) { + char *to = NULL, *from = NULL; + + /* This is an attended transfer */ + referdata->attendedtransfer = 1; + ast_copy_string(referdata->replaces_callid, ptr+9, sizeof(referdata->replaces_callid)); + ast_uri_decode(referdata->replaces_callid); + if ((ptr = strchr(referdata->replaces_callid, ';'))) /* Find options */ { + *ptr++ = '\0'; + } + + if (ptr) { + /* Find the different tags before we destroy the string */ + to = strcasestr(ptr, "to-tag="); + from = strcasestr(ptr, "from-tag="); + } + + /* Grab the to header */ + if (to) { + ptr = to + 7; + if ((to = strchr(ptr, '&'))) + *to = '\0'; + if ((to = strchr(ptr, ';'))) + *to = '\0'; + ast_copy_string(referdata->replaces_callid_totag, ptr, sizeof(referdata->replaces_callid_totag)); + } + + if (from) { + ptr = from + 9; + if ((to = strchr(ptr, '&'))) + *to = '\0'; + if ((to = strchr(ptr, ';'))) + *to = '\0'; + ast_copy_string(referdata->replaces_callid_fromtag, ptr, sizeof(referdata->replaces_callid_fromtag)); + } + + if (option_debug > 1) { + if (!pedanticsipchecking) + ast_log(LOG_DEBUG,"Attended transfer: Will use Replace-Call-ID : %s (No check of from/to tags)\n", referdata->replaces_callid ); + else + ast_log(LOG_DEBUG,"Attended transfer: Will use Replace-Call-ID : %s F-tag: %s T-tag: %s\n", referdata->replaces_callid, referdata->replaces_callid_fromtag ? referdata->replaces_callid_fromtag : "<none>", referdata->replaces_callid_totag ? referdata->replaces_callid_totag : "<none>" ); } } |