[svn-commits] oej: trunk r63032 - in /trunk/channels: chan_iax2.c chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri May 4 06:56:25 MST 2007


Author: oej
Date: Fri May  4 08:56:25 2007
New Revision: 63032

URL: http://svn.digium.com/view/asterisk?view=rev&rev=63032
Log:
Add the new ChannelUpdate event to inform manager clients about the PVT ID and some other channel driver data that
is needed to follow the call through the PBX.

Modified:
    trunk/channels/chan_iax2.c
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=63032&r1=63031&r2=63032
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Fri May  4 08:56:25 2007
@@ -895,6 +895,17 @@
 	 * is time to send MWI, since it is only sent with a REGACK. */
 }
 
+/*! \brief Send manager event at call setup to link between Asterisk channel name
+	and IAX2 call identifiers */
+static void iax2_ami_channelupdate(struct chan_iax2_pvt *pvt) 
+{
+	manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
+		"Channel: %s\r\nChanneltype: IAX2\r\nIAX2-callno-local: %d\r\nIAX2-callno-remote: %d\r\nIAX2-peer: %s\r\n",
+		pvt->owner ? pvt->owner->name : "",
+		pvt->callno, pvt->peercallno, pvt->peer ? pvt->peer : "");
+}
+
+
 static void insert_idle_thread(struct iax2_thread *thread)
 {
 	if (thread->type == IAX_THREAD_TYPE_DYNAMIC) {
@@ -3332,6 +3343,7 @@
 	unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Answering IAX2 call\n");
+	iax2_ami_channelupdate(c->tech_pvt);
 	return send_command_locked(callno, AST_FRAME_CONTROL, AST_CONTROL_ANSWER, 0, NULL, 0, -1);
 }
 
@@ -3422,6 +3434,7 @@
 	ast_mutex_unlock(&iaxsl[callno]);
 	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "IAX2/%s-%d", i->host, i->callno);
 	ast_mutex_lock(&iaxsl[callno]);
+	iax2_ami_channelupdate(i);
 	if (!tmp)
 		return NULL;
 	tmp->tech = &iax2_tech;

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=63032&r1=63031&r2=63032
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri May  4 08:56:25 2007
@@ -4264,6 +4264,12 @@
 	if (!ast_test_flag(&i->flags[0], SIP_NO_HISTORY))
 		append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
 
+	/* Inform manager user about new channel and their SIP call ID */
+	if (global_callevents)
+		manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
+			"Channel: %s\r\nUniqueid: %s\r\nChanneltype: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\n",
+			tmp->name, tmp->uniqueid, "SIP", i->callid, i->fullcontact);
+
 	return tmp;
 }
 
@@ -12601,6 +12607,10 @@
 		if (!ast_test_flag(req, SIP_PKT_IGNORE) && p->owner) {
 			if (!reinvite) {
 				ast_queue_control(p->owner, AST_CONTROL_ANSWER);
+				if (global_callevents)
+					manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
+						"Channel: %s\r\nChanneltype: %s\r\nUniqueid: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n",
+						p->owner->name, p->owner->uniqueid, "SIP", p->callid, p->fullcontact, p->peername);
 			} else {	/* RE-invite */
 				ast_queue_frame(p->owner, &ast_null_frame);
 			}
@@ -16240,6 +16250,10 @@
 	p->jointcapability = oldformat;
 	sip_pvt_lock(p);
 	tmpc = sip_new(p, AST_STATE_DOWN, host);	/* Place the call */
+	if (global_callevents)
+		manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
+			"Channel: %s\r\nChanneltype: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n",
+			p->owner? p->owner->name : "", "SIP", p->callid, p->fullcontact, p->peername);
 	sip_pvt_unlock(p);
 	if (!tmpc)
 		sip_destroy(p);



More information about the svn-commits mailing list