[svn-commits] dvossel: branch group/aoc r251883 - /team/group/aoc/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 11 14:44:33 CST 2010


Author: dvossel
Date: Thu Mar 11 14:44:29 2010
New Revision: 251883

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=251883
Log:
support for aoc-e messages over sip

Modified:
    team/group/aoc/channels/chan_sip.c

Modified: team/group/aoc/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/aoc/channels/chan_sip.c?view=diff&rev=251883&r1=251882&r2=251883
==============================================================================
--- team/group/aoc/channels/chan_sip.c (original)
+++ team/group/aoc/channels/chan_sip.c Thu Mar 11 14:44:29 2010
@@ -1018,7 +1018,7 @@
 static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch);
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init);
 static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int oldsdp);
-static int transmit_info_with_aocd(struct sip_pvt *p, struct ast_aoc_decoded *decoded);
+static int transmit_info_with_aoc(struct sip_pvt *p, struct ast_aoc_decoded *decoded);
 static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration);
 static int transmit_info_with_vidupdate(struct sip_pvt *p);
 static int transmit_message_with_text(struct sip_pvt *p, const char *text);
@@ -5370,12 +5370,8 @@
 		{
 			struct ast_aoc_decoded *decoded = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen);
 			if (decoded) {
-				if (ast_aoc_get_msg_type(decoded) == AOC_D) {
-					transmit_info_with_aocd(p, decoded);
-					ast_aoc_destroy_decoded(decoded);
-				} else if(ast_aoc_get_msg_type(decoded) == AOC_E) {
-					/* TODO XXX implement a way of sending AOC_E */
-				}
+				transmit_info_with_aoc(p, decoded);
+				ast_aoc_destroy_decoded(decoded);
 			} else {
 				ast_log(LOG_ERROR, "Error decoding indicated AOC data\n");
 				res = -1;
@@ -10831,7 +10827,7 @@
 }
 
 /*! \brief Send SIP INFO advice of charge message */
-static int transmit_info_with_aocd(struct sip_pvt *p, struct ast_aoc_decoded *decoded)
+static int transmit_info_with_aoc(struct sip_pvt *p, struct ast_aoc_decoded *decoded)
 {
 	struct sip_request req;
 	struct ast_str *str = ast_str_alloca(512);
@@ -10840,7 +10836,14 @@
 
 	reqprep(&req, p, SIP_INFO, 0, 1);
 
-	ast_str_append(&str, 0, "type=active;");
+	if (ast_aoc_get_msg_type(decoded) == AOC_D) {
+		ast_str_append(&str, 0, "type=active;");
+	} else if (ast_aoc_get_msg_type(decoded) == AOC_E) {
+		ast_str_append(&str, 0, "type=terminated;");
+	} else {
+		/* unsupported message type */
+		return -1;
+	}
 
 	switch (charging) {
 	case AOC_CHARGE_FREE:




More information about the svn-commits mailing list