aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-06 04:02:33 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-06 04:02:33 +0000
commit043f9e3c186843be4c078e68b61d582ca7256634 (patch)
treee6d54d0760819fbf49f6b1a20dca52a630402725 /channels/chan_mgcp.c
parentced25cfef8a908551d8ce1cfd6b9ff9508de194b (diff)
Merge distinctive ring for MGCP (bug #2880, with mods)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4690 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rwxr-xr-xchannels/chan_mgcp.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 2cc84fc83..aff41bca8 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -11,6 +11,10 @@
* the GNU General Public License
*/
+/* FO: Changes
+ * -- add distinctive ring signalling (part of RFC 3660)
+ */
+
/* JS: Changes
-- add support for the wildcard endpoint
-- seteable wildcard with wcardep on mgcp.conf
@@ -848,24 +852,41 @@ static int send_request(struct mgcp_endpoint *p, struct mgcp_subchannel *sub,
static int mgcp_call(struct ast_channel *ast, char *dest, int timeout)
{
- int res;
- struct mgcp_endpoint *p;
+ int res;
+ struct mgcp_endpoint *p;
struct mgcp_subchannel *sub;
- char *tone;
+ char tone[50]="";
+ char *distinctive_ring = NULL;
+ struct varshead *headp;
+ struct ast_var_t *current;
if (mgcpdebug) {
ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_call(%s)\n", ast->name);
}
- sub = ast->pvt->pvt;
+ sub = ast->pvt->pvt;
p = sub->parent;
- ast_mutex_lock(&sub->lock);
+ headp=&ast->varshead;
+ AST_LIST_TRAVERSE(headp,current,entries) {
+ /* Check whether there is a ALERT_INFO variable */
+ if (strcasecmp(ast_var_name(current),"ALERT_INFO")==0) {
+ distinctive_ring = ast_var_value(current);
+ }
+ }
+ +
+ ast_mutex_lock(&sub->lock);
switch (p->hookstate) {
case MGCP_OFFHOOK:
- tone = "L/wt";
+ snprintf(tone, sizeof(tone), "L/wt");
break;
case MGCP_ONHOOK:
default:
- tone = "L/rg";
+ if (distinctive_ring && !ast_strlen_zero(distinctive_ring)) {
+ snprintf(tone, sizeof(tone), "L/r%s", distinctive_ring);
+ ast_verbose(VERBOSE_PREFIX_2 "MGCP distinctive ring %s\n", tone);
+ } else {
+ snprintf(tone, sizeof(tone), "L/rg");
+ ast_verbose(VERBOSE_PREFIX_2 "MGCP default ring\n");
+ }
break;
}