From f8fd21a76914f014fbbd305c52143dbc5ca8d208 Mon Sep 17 00:00:00 2001 From: russell Date: Sat, 10 Feb 2007 00:35:09 +0000 Subject: Merge team/russell/sla_rewrite This is a completely new implementation of the SLA functionality introduced in Asterisk 1.4. It is now functional and ready for testing. However, I will be adding some additional features over the next week, as well. For information on how to set this up, see configs/sla.conf.sample and doc/sla.txt. In addition to the changes in app_meetme.c for the SLA implementation itself, this merge brings in various other changes: chan_sip: - Add the ability to indicate HOLD state in NOTIFY messages. - Queue HOLD and UNHOLD control frames even if the channel is not bridged to another channel. linkedlists.h: - Add support for rwlock based linked lists. dial.c: - Add the ability to run ast_dial_start() without a reference channel to inherit information from. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@53810 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_sip.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'channels') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b508499ec..d11e633ff 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4705,7 +4705,6 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req) int iterator; int sendonly = 0; int numberofports; - struct ast_channel *bridgepeer = NULL; struct ast_rtp *newaudiortp, *newvideortp; /* Buffers for codec handling */ int newjointcapability; /* Negotiated capability */ int newpeercapability; @@ -5196,22 +5195,21 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req) ast_set_write_format(p->owner, p->owner->writeformat); } - /* Turn on/off music on hold if we are holding/unholding */ - if ((bridgepeer = ast_bridged_channel(p->owner))) { - if (sin.sin_addr.s_addr && !sendonly) { - ast_queue_control(p->owner, AST_CONTROL_UNHOLD); - /* Activate a re-invite */ - ast_queue_frame(p->owner, &ast_null_frame); - } else if (!sin.sin_addr.s_addr || sendonly) { - ast_queue_control_data(p->owner, AST_CONTROL_HOLD, - S_OR(p->mohsuggest, NULL), - !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0); - if (sendonly) - ast_rtp_stop(p->rtp); - /* RTCP needs to go ahead, even if we're on hold!!! */ - /* Activate a re-invite */ - ast_queue_frame(p->owner, &ast_null_frame); - } + if (sin.sin_addr.s_addr && !sendonly) { + ast_log(LOG_DEBUG, "Queueing UNHOLD!\n"); + ast_queue_control(p->owner, AST_CONTROL_UNHOLD); + /* Activate a re-invite */ + ast_queue_frame(p->owner, &ast_null_frame); + } else if (!sin.sin_addr.s_addr || sendonly) { + ast_log(LOG_DEBUG, "Going on HOLD!\n"); + ast_queue_control_data(p->owner, AST_CONTROL_HOLD, + S_OR(p->mohsuggest, NULL), + !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0); + if (sendonly) + ast_rtp_stop(p->rtp); + /* RTCP needs to go ahead, even if we're on hold!!! */ + /* Activate a re-invite */ + ast_queue_frame(p->owner, &ast_null_frame); } /* Manager Hold and Unhold events must be generated, if necessary */ @@ -6868,6 +6866,10 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full, int tim pidfnote = "Unavailable"; break; case AST_EXTENSION_ONHOLD: + statestring = "confirmed"; + local_state = NOTIFY_INUSE; + pidfstate = "busy"; + pidfnote = "On the phone"; break; case AST_EXTENSION_NOT_INUSE: default: @@ -6963,6 +6965,11 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full, int tim else ast_build_string(&t, &maxbytes, "\n", p->exten); ast_build_string(&t, &maxbytes, "%s\n", statestring); + if (state == AST_EXTENSION_ONHOLD) { + ast_build_string(&t, &maxbytes, "\n\n" + "\n" + "\n\n", mto); + } ast_build_string(&t, &maxbytes, "\n\n"); break; case NONE: -- cgit v1.2.3