[svn-commits] dlee: branch dlee/playback-controls r389590 - in /team/dlee/playback-controls...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 23 15:14:50 CDT 2013


Author: dlee
Date: Thu May 23 15:14:46 2013
New Revision: 389590

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389590
Log:
Merged revisions 389492-389569 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/dlee/playback-controls/   (props changed)
    team/dlee/playback-controls/apps/app_dial.c
    team/dlee/playback-controls/apps/app_followme.c
    team/dlee/playback-controls/apps/app_queue.c
    team/dlee/playback-controls/include/asterisk/dial.h
    team/dlee/playback-controls/main/app.c
    team/dlee/playback-controls/main/dial.c
    team/dlee/playback-controls/main/features.c
    team/dlee/playback-controls/res/res_sip_sdp_rtp.c
    team/dlee/playback-controls/res/res_sip_session.c

Propchange: team/dlee/playback-controls/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May 23 15:14:46 2013
@@ -1,1 +1,1 @@
-/team/dlee/playback-rebase:1-389487 /trunk:1-389486
+/team/dlee/playback-rebase:1-389487 /trunk:1-389586

Modified: team/dlee/playback-controls/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/apps/app_dial.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/apps/app_dial.c (original)
+++ team/dlee/playback-controls/apps/app_dial.c Thu May 23 15:14:46 2013
@@ -66,8 +66,9 @@
 #include "asterisk/ccss.h"
 #include "asterisk/indications.h"
 #include "asterisk/framehook.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
 #include "asterisk/bridging.h"
-#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="Dial" language="en_US">
@@ -1014,9 +1015,15 @@
 			num->nochan++;
 		} else {
 			ast_channel_lock_both(c, in);
-			ast_channel_publish_dial(c, in, stuff, NULL);
+			ast_channel_publish_dial(in, c, stuff, NULL);
 			ast_channel_unlock(in);
 			ast_channel_unlock(c);
+
+			ast_channel_lock_both(original, in);
+			ast_channel_publish_dial(in, original, NULL, "CANCEL");
+			ast_channel_unlock(in);
+			ast_channel_unlock(original);
+
 			/* Hangup the original channel now, in case we needed it */
 			ast_hangup(original);
 		}
@@ -1034,22 +1041,6 @@
 	char privintro[1024];
 	char status[256];
 };
-
-static const char *hangup_cause_to_dial_status(int hangup_cause)
-{
-	switch(hangup_cause) {
-	case AST_CAUSE_BUSY:
-		return "BUSY";
-	case AST_CAUSE_CONGESTION:
-		return "CONGESTION";
-	case AST_CAUSE_NO_ROUTE_DESTINATION:
-	case AST_CAUSE_UNREGISTERED:
-		return "CHANUNAVAIL";
-	case AST_CAUSE_NO_ANSWER:
-	default:
-		return "NOANSWER";
-	}
-}
 
 static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
 {
@@ -1266,7 +1257,7 @@
 #ifdef HAVE_EPOLL
 				ast_poll_channel_del(in, c);
 #endif
-				ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+				ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 				ast_hangup(c);
 				c = o->chan = NULL;
 				ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1334,7 +1325,7 @@
 				case AST_CONTROL_BUSY:
 					ast_verb(3, "%s is busy\n", ast_channel_name(c));
 					ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
-					ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+					ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 					ast_hangup(c);
 					c = o->chan = NULL;
 					ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1343,7 +1334,7 @@
 				case AST_CONTROL_CONGESTION:
 					ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c));
 					ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
-					ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+					ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
 					ast_hangup(c);
 					c = o->chan = NULL;
 					ast_clear_flag64(o, DIAL_STILLGOING);

Modified: team/dlee/playback-controls/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/apps/app_followme.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/apps/app_followme.c (original)
+++ team/dlee/playback-controls/apps/app_followme.c Thu May 23 15:14:46 2013
@@ -63,6 +63,7 @@
 #include "asterisk/astdb.h"
 #include "asterisk/dsp.h"
 #include "asterisk/app.h"
+#include "asterisk/stasis_channels.h"
 
 /*** DOCUMENTATION
 	<application name="FollowMe" language="en_US">
@@ -556,6 +557,17 @@
 	return 1;
 }
 
+static void publish_dial_end_event(struct ast_channel *in, struct findme_user_listptr *findme_user_list, struct ast_channel *exception, const char *status)
+{
+	struct findme_user *tmpuser;
+
+	AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry) {
+		if (tmpuser->ochan && tmpuser->ochan != exception) {
+			ast_channel_publish_dial(in, tmpuser->ochan, NULL, status);
+		}
+	}
+}
+
 static void clear_caller(struct findme_user *tmpuser)
 {
 	struct ast_channel *outbound;
@@ -777,6 +789,7 @@
 						}
 						if (!tmpuser) {
 							ast_verb(3, "The calling channel hungup. Need to drop everyone.\n");
+							publish_dial_end_event(caller, findme_user_list, NULL, "CANCEL");
 							ast_frfree(f);
 							return NULL;
 						}
@@ -788,6 +801,8 @@
 							break;
 						}
 						ast_verb(3, "%s answered %s\n", ast_channel_name(winner), ast_channel_name(caller));
+						ast_channel_publish_dial(caller, winner, NULL, "ANSWER");
+						publish_dial_end_event(caller, findme_user_list, winner, "CANCEL");
 						tmpuser->answered = 1;
 						/* If call has been answered, then the eventual hangup is likely to be normal hangup */ 
 						ast_channel_hangupcause_set(winner, AST_CAUSE_NORMAL_CLEARING);
@@ -815,6 +830,7 @@
 						ast_verb(3, "%s is busy\n", ast_channel_name(winner));
 						if (tmpuser) {
 							/* Outbound call was busy.  Drop it. */
+							ast_channel_publish_dial(caller, winner, NULL, "BUSY");
 							clear_caller(tmpuser);
 						}
 						break;
@@ -822,6 +838,7 @@
 						ast_verb(3, "%s is circuit-busy\n", ast_channel_name(winner));
 						if (tmpuser) {
 							/* Outbound call was congested.  Drop it. */
+							ast_channel_publish_dial(caller, winner, NULL, "CONGESTION");
 							clear_caller(tmpuser);
 						}
 						break;
@@ -970,6 +987,7 @@
 					return NULL;
 				}
 				/* Outgoing channel hung up. */
+				ast_channel_publish_dial(caller, winner, NULL, "NOANSWER");
 				clear_caller(tmpuser);
 			}
 		} else {
@@ -1141,7 +1159,10 @@
 				}
 				ast_channel_unlock(tmpuser->ochan);
 				destroy_calling_node(tmpuser);
-			}
+				continue;
+			}
+
+			ast_channel_publish_dial(caller, tmpuser->ochan, tmpuser->dialarg, NULL);
 		}
 		AST_LIST_TRAVERSE_SAFE_END;
 

Modified: team/dlee/playback-controls/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/apps/app_queue.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/apps/app_queue.c (original)
+++ team/dlee/playback-controls/apps/app_queue.c Thu May 23 15:14:46 2013
@@ -106,6 +106,8 @@
 #include "asterisk/cel.h"
 #include "asterisk/data.h"
 #include "asterisk/term.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
 #include "asterisk/bridging.h"
 
 /* Define, to debug reference counts on queues, without debugging reference counts on queue members */
@@ -3330,8 +3332,19 @@
 	ast_free(doomed);
 }
 
+static void publish_dial_end_event(struct ast_channel *in, struct callattempt *outgoing, struct ast_channel *exception, const char *status)
+{
+	struct callattempt *cur;
+
+	for (cur = outgoing; cur; cur = cur->q_next) {
+                if (cur->chan && cur->chan != exception) {
+			ast_channel_publish_dial(in, cur->chan, NULL, status);
+                }
+        }
+}
+
 /*! \brief Hang up a list of outgoing calls */
-static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
+static void hangupcalls(struct queue_ent *qe, struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
 {
 	struct callattempt *oo;
 
@@ -3342,6 +3355,7 @@
 			if (exception || cancel_answered_elsewhere) {
 				ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
 			}
+			ast_channel_publish_dial(qe->chan, outgoing->chan, outgoing->interface, "CANCEL");
 			ast_hangup(outgoing->chan);
 		}
 		oo = outgoing;
@@ -3712,10 +3726,10 @@
 		return 0;
 	}
 
+	ast_channel_lock_both(tmp->chan, qe->chan);
+
 	if (qe->parent->eventwhencalled) {
 		char vars[2048];
-
-		ast_channel_lock_both(tmp->chan, qe->chan);
 
 		/*** DOCUMENTATION
 		<managerEventInstance>
@@ -3761,12 +3775,14 @@
 			S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"),
 			ast_channel_context(qe->chan), ast_channel_exten(qe->chan), ast_channel_priority(qe->chan), ast_channel_uniqueid(qe->chan),
 			qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
-
-		ast_channel_unlock(tmp->chan);
-		ast_channel_unlock(qe->chan);
-
-		ast_verb(3, "Called %s\n", tmp->interface);
-	}
+	}
+
+	ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
+
+	ast_channel_unlock(tmp->chan);
+	ast_channel_unlock(qe->chan);
+
+	ast_verb(3, "Called %s\n", tmp->interface);
 
 	member_call_pending_clear(tmp->member);
 	return 1;
@@ -4334,6 +4350,15 @@
 							numnochan++;
 						}
 					}
+					ast_channel_lock_both(qe->chan, o->chan);
+					ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL);
+					ast_channel_unlock(o->chan);
+					ast_channel_unlock(qe->chan);
+
+					ast_channel_lock_both(qe->chan, original);
+					ast_channel_publish_dial(qe->chan, original, NULL, "CANCEL");
+					ast_channel_unlock(original);
+					ast_channel_unlock(qe->chan);
 					/* Hangup the original channel now, in case we needed it */
 					ast_hangup(winner);
 					continue;
@@ -4346,6 +4371,8 @@
 							/* This is our guy if someone answered. */
 							if (!peer) {
 								ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
+								ast_channel_publish_dial(qe->chan, o->chan, on, "ANSWER");
+								publish_dial_end_event(qe->chan, outgoing, o->chan, "CANCEL");
 								if (!o->block_connected_update) {
 									if (o->pending_connected_update) {
 										if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
@@ -4380,6 +4407,7 @@
 							if (ast_channel_cdr(in)) {
 								ast_cdr_busy(ast_channel_cdr(in));
 							}
+							ast_channel_publish_dial(qe->chan, o->chan, on, "BUSY");
 							do_hang(o);
 							endtime = (long) time(NULL);
 							endtime -= starttime;
@@ -4401,6 +4429,7 @@
 							if (ast_channel_cdr(in)) {
 								ast_cdr_failed(ast_channel_cdr(in));
 							}
+							ast_channel_publish_dial(qe->chan, o->chan, on, "CONGESTION");
 							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail);
@@ -4498,6 +4527,7 @@
 					ast_frfree(f);
 				} else { /* ast_read() returned NULL */
 					endtime = (long) time(NULL) - starttime;
+					ast_channel_publish_dial(qe->chan, o->chan, on, "NOANSWER");
 					rna(endtime * 1000, qe, on, membername, 1);
 					do_hang(o);
 					if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
@@ -4519,6 +4549,7 @@
 			if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
 				/* Got hung up */
 				*to = -1;
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				if (f) {
 					if (f->data.uint32) {
 						ast_channel_hangupcause_set(in, f->data.uint32);
@@ -4531,6 +4562,7 @@
 			if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
 				ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
 				*to = 0;
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				ast_frfree(f);
 				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
 					ast_cdr_noanswer(ast_channel_cdr(in));
@@ -4540,6 +4572,7 @@
 			if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
 				ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
 				*to = 0;
+				publish_dial_end_event(in, outgoing, NULL, "CANCEL");
 				*digit = f->subclass.integer;
 				ast_frfree(f);
 				if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
@@ -4600,6 +4633,7 @@
 			rna(orig, qe, o->interface, o->member->membername, 1);
 		}
 
+		publish_dial_end_event(qe->chan, outgoing, NULL, "NOANSWER");
 		if (ast_channel_cdr(in)
 			&& ast_channel_state(in) != AST_STATE_UP
 			&& (!*to || ast_check_hangup(in))) {
@@ -5509,7 +5543,7 @@
 		member = lpeer->member;
 		/* Increment the refcount for this member, since we're going to be using it for awhile in here. */
 		ao2_ref(member, 1);
-		hangupcalls(outgoing, peer, qe->cancel_answered_elsewhere);
+		hangupcalls(qe, outgoing, peer, qe->cancel_answered_elsewhere);
 		outgoing = NULL;
 		if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) {
 			int res2;
@@ -5552,7 +5586,7 @@
 				/* Agent must have hung up */
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.\n", ast_channel_name(peer));
 				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "AGENTDUMP", "%s", "");
-				if (qe->parent->eventwhencalled)
+				if (qe->parent->eventwhencalled) {
 					/*** DOCUMENTATION
 					<managerEventInstance>
 						<synopsis>Raised when an agent hangs up on a member in the queue.</synopsis>
@@ -5577,6 +5611,8 @@
 							"%s",
 							queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
 							qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+				}
+				ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
 				ast_autoservice_chan_hangup_peer(qe->chan, peer);
 				ao2_ref(member, -1);
 				goto out;
@@ -5585,6 +5621,7 @@
 				ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", ast_channel_name(peer));
 				ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
 				record_abandoned(qe);
+				ast_channel_publish_dial(qe->chan, peer, member->interface, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(peer)));
 				ast_autoservice_chan_hangup_peer(qe->chan, peer);
 				ao2_ref(member, -1);
 				return -1;
@@ -5877,7 +5914,7 @@
 			}
 		}
 
-		if (qe->parent->eventwhencalled)
+		if (qe->parent->eventwhencalled) {
 			/*** DOCUMENTATION
 			<managerEventInstance>
 				<synopsis>Raised when an agent answers and is bridged to a member in the queue.</synopsis>
@@ -5909,6 +5946,8 @@
 					queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
 					(long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0),
 					qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
+		}
+
 		ast_copy_string(oldcontext, ast_channel_context(qe->chan), sizeof(oldcontext));
 		ast_copy_string(oldexten, ast_channel_exten(qe->chan), sizeof(oldexten));
 	
@@ -5977,7 +6016,7 @@
 		ao2_ref(member, -1);
 	}
 out:
-	hangupcalls(outgoing, NULL, qe->cancel_answered_elsewhere);
+	hangupcalls(qe, outgoing, NULL, qe->cancel_answered_elsewhere);
 
 	return res;
 }

Modified: team/dlee/playback-controls/include/asterisk/dial.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/include/asterisk/dial.h?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/include/asterisk/dial.h (original)
+++ team/dlee/playback-controls/include/asterisk/dial.h Thu May 23 15:14:46 2013
@@ -206,6 +206,11 @@
  */
 void ast_dial_set_timeout(struct ast_dial *dial, int num, int timeout);
 
+/*! \since 12
+ * \brief Convert a hangup cause to a publishable dial status
+ */
+const char *ast_hangup_cause_to_dial_status(int hangup_cause);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/dlee/playback-controls/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/main/app.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/main/app.c (original)
+++ team/dlee/playback-controls/main/app.c Thu May 23 15:14:46 2013
@@ -2746,6 +2746,9 @@
 
 int app_init(void)
 {
+	if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) {
+		return -1;
+	}
 	mwi_topic_all = stasis_topic_create("stasis_mwi_topic");
 	if (!mwi_topic_all) {
 		return -1;
@@ -2754,9 +2757,6 @@
 	if (!mwi_topic_cached) {
 		return -1;
 	}
-	if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) {
-		return -1;
-	}
 	mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all);
 	if (!mwi_topic_pool) {
 		return -1;

Modified: team/dlee/playback-controls/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/main/dial.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/main/dial.c (original)
+++ team/dlee/playback-controls/main/dial.c Thu May 23 15:14:46 2013
@@ -616,10 +616,7 @@
 	return new_timeout;
 }
 
-/*! \since 12
- * \internal \brief Convert a hangup cause to a publishable dial status
- */
-static const char *hangup_cause_to_dial_status(int hangup_cause)
+const char *ast_hangup_cause_to_dial_status(int hangup_cause)
 {
 	switch(hangup_cause) {
 	case AST_CAUSE_BUSY:
@@ -728,7 +725,7 @@
 			}
 			if (chan)
 				ast_poll_channel_del(chan, channel->owner);
-			ast_channel_publish_dial(chan, who, channel->device, hangup_cause_to_dial_status(ast_channel_hangupcause(who)));
+			ast_channel_publish_dial(chan, who, channel->device, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(who)));
 			ast_hangup(who);
 			channel->owner = NULL;
 			continue;

Modified: team/dlee/playback-controls/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/main/features.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/main/features.c (original)
+++ team/dlee/playback-controls/main/features.c Thu May 23 15:14:46 2013
@@ -4181,7 +4181,7 @@
 	}
 	if (ast_test_flag(flags, AST_FEATURE_DISCONNECT)) {
 		builtin_feature_get_exten(chan, "disconnect", dtmf, sizeof(dtmf));
-		if (ast_strlen_zero(dtmf)) {
+		if (!ast_strlen_zero(dtmf)) {
 			res |= ast_bridge_features_enable(features, AST_BRIDGE_BUILTIN_HANGUP, dtmf, NULL, NULL, 1);
 		}
 	}

Modified: team/dlee/playback-controls/res/res_sip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/res/res_sip_sdp_rtp.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/res/res_sip_sdp_rtp.c (original)
+++ team/dlee/playback-controls/res/res_sip_sdp_rtp.c Thu May 23 15:14:46 2013
@@ -121,6 +121,12 @@
 		ice->stop(session_media->rtp);
 	}
 
+	if (session->endpoint->dtmf == AST_SIP_DTMF_RFC_4733) {
+		ast_rtp_instance_dtmf_mode_set(session_media->rtp, AST_RTP_DTMF_MODE_RFC2833);
+	} else if (session->endpoint->dtmf == AST_SIP_DTMF_INBAND) {
+		ast_rtp_instance_dtmf_mode_set(session_media->rtp, AST_RTP_DTMF_MODE_INBAND);
+	}
+
 	return 0;
 }
 
@@ -224,11 +230,11 @@
 	if (session->channel) {
 		ast_format_cap_copy(caps, ast_channel_nativeformats(session->channel));
 		ast_format_cap_remove_bytype(caps, media_type);
-		ast_format_cap_append(caps, joint);
+		ast_codec_choose(&session->endpoint->prefs, joint, 1, &fmt);
+		ast_format_cap_add(caps, &fmt);
 
 		/* Apply the new formats to the channel, potentially changing read/write formats while doing so */
-		ast_format_cap_append(ast_channel_nativeformats(session->channel), caps);
-		ast_codec_choose(&session->endpoint->prefs, caps, 0, &fmt);
+		ast_format_cap_copy(ast_channel_nativeformats(session->channel), caps);
 		ast_format_copy(ast_channel_rawwriteformat(session->channel), &fmt);
 		ast_format_copy(ast_channel_rawreadformat(session->channel), &fmt);
 		ast_set_read_format(session->channel, ast_channel_readformat(session->channel));

Modified: team/dlee/playback-controls/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-controls/res/res_sip_session.c?view=diff&rev=389590&r1=389589&r2=389590
==============================================================================
--- team/dlee/playback-controls/res/res_sip_session.c (original)
+++ team/dlee/playback-controls/res/res_sip_session.c Thu May 23 15:14:46 2013
@@ -1035,6 +1035,7 @@
 	}
 
 	pjsip_inv_set_local_sdp(inv_session, offer);
+	pjmedia_sdp_neg_set_prefer_remote_codec_order(inv_session->neg, PJ_FALSE);
 
 	ao2_ref(session, +1);
 	return session;
@@ -1195,6 +1196,7 @@
 		return;
 	} else {
 		pjsip_inv_set_local_sdp(inv_session, local);
+		pjmedia_sdp_neg_set_prefer_remote_codec_order(inv_session->neg, PJ_FALSE);
 	}
 
 	pjsip_timer_setting_default(&timer);




More information about the svn-commits mailing list