diff -ur asterisk/channels/chan_sip.c asterisk-work/channels/chan_sip.c --- asterisk/channels/chan_sip.c 2004-12-31 17:43:04.000000000 +0800 +++ asterisk-work/channels/chan_sip.c 2005-02-04 14:19:42.261761368 +0800 @@ -321,6 +321,7 @@ int tag; /* Another random number */ int sessionid; /* SDP Session ID */ int sessionversion; /* SDP Session Version */ + int intercom; /* Whether this is an intercom call */ struct sockaddr_in sa; /* Our peer */ struct sockaddr_in redirip; /* Where our RTP should be going if not to us */ struct sockaddr_in vredirip; /* Where our Video RTP should be going if not to us */ @@ -1398,12 +1399,17 @@ ast_log(LOG_WARNING, "sip_call called on %s, neither down nor reserved\n", ast->name); return -1; } - /* Check whether there is vxml_url, distinctive ring variables */ + /* Check whether there is vxml_url, distinctive ring variables, or intercom */ headp=&ast->varshead; AST_LIST_TRAVERSE(headp,current,entries) { - /* Check whether there is a VXML_URL variable */ - if (!vxml_url && !strcasecmp(ast_var_name(current),"VXML_URL")) { + if (!p->intercom && !strcasecmp(ast_var_name(current),"INTERCOM")) { + /* Check whether there is a INTERCOM variable */ + if (!strcasecmp(ast_var_value(current), "true")) { + p->intercom = 1; + } + } else if (!vxml_url && !strcasecmp(ast_var_name(current),"VXML_URL")) { + /* Check whether there is a VXML_URL variable */ vxml_url = ast_var_value(current); } else if (!distinctive_ring && !strcasecmp(ast_var_name(current),"ALERT_INFO")) { /* Check whether there is a ALERT_INFO variable */ @@ -2273,6 +2279,7 @@ memset(p, 0, sizeof(struct sip_pvt)); ast_mutex_init(&p->lock); + p->intercom = 0; p->initid = -1; p->autokillid = -1; p->stateid = -1; @@ -3668,7 +3675,7 @@ char invite[256]=""; char from[256]; char to[256]; - char tmp[80]; + char tmp[256]; char iabuf[INET_ADDRSTRLEN]; char *l = default_callerid, *n=NULL; int x; @@ -3740,7 +3747,13 @@ } else { snprintf(invite, sizeof(invite), "sip:%s%s", p->tohost, urioptions); } strncpy(p->uri, invite, sizeof(p->uri) - 1); + /* If there is an intercom request append it */ + if (p->intercom) + { + snprintf(tmp, sizeof(tmp), "%s;intercom=true", invite); + snprintf(invite, sizeof(invite), "%s", tmp); + } /* If there is a VXML URL append it to the SIP URL */ if (vxml_url) {