[asterisk-commits] igorg: branch 11 r409745 - /branches/11/channels/chan_unistim.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 4 23:54:18 CST 2014


Author: igorg
Date: Tue Mar  4 23:54:11 2014
New Revision: 409745

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=409745
Log:

Add update_peer function to unistim_rtp_glue, improve other unistim_rtp_glue functions conforming to other channel drivers. Do not forget auto-detected and user-selected phone settings on 'unistim reload'
........

Merged revisions 409705 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/channels/chan_unistim.c

Modified: branches/11/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_unistim.c?view=diff&rev=409745&r1=409744&r2=409745
==============================================================================
--- branches/11/channels/chan_unistim.c (original)
+++ branches/11/channels/chan_unistim.c Tue Mar  4 23:54:11 2014
@@ -5240,6 +5240,7 @@
 		if (sub->subtype == SUB_REAL) {
 			send_callerid_screen(s, sub);
 		}
+	case AST_CONTROL_UPDATE_RTP_PEER:
 		break;
 	case AST_CONTROL_SRCCHANGE:
 		ast_rtp_instance_change_source(sub->rtp);
@@ -6291,6 +6292,13 @@
 		}
 		ast_mutex_init(&d->lock);
 		ast_copy_string(d->name, cat, sizeof(d->name));
+		d->contrast = -1;
+		d->output = OUTPUT_HANDSET;
+		d->previous_output = OUTPUT_HANDSET;
+		d->volume = VOLUME_LOW;
+		d->mute = MUTE_OFF;
+		d->height = DEFAULTHEIGHT;
+		d->selected = -1;
 	} else {
 		/* Delete existing line information */
 		AST_LIST_LOCK(&d->lines);
@@ -6310,14 +6318,7 @@
 		memset(d->sline, 0, sizeof(d->sline));
 		memset(d->sp, 0, sizeof(d->sp));
 	}
-
 	ast_copy_string(d->context, DEFAULTCONTEXT, sizeof(d->context));
-	d->contrast = -1;
-	d->output = OUTPUT_HANDSET;
-	d->previous_output = OUTPUT_HANDSET;
-	d->volume = VOLUME_LOW;
-	d->mute = MUTE_OFF;
-	d->height = DEFAULTHEIGHT;
 	d->selected = -1;
 	d->interdigit_timer = DEFAULT_INTERDIGIT_TIMER;
 	linelabel[0] = '\0';
@@ -6849,15 +6850,51 @@
 {
 	struct unistim_subchannel *sub = ast_channel_tech_pvt(chan);
 
+	if (!sub) {
+		return AST_RTP_GLUE_RESULT_FORBID;
+	}
+	if (!sub->rtp) {
+		return AST_RTP_GLUE_RESULT_FORBID;
+	}
+
 	ao2_ref(sub->rtp, +1);
 	*instance = sub->rtp;
 
 	return AST_RTP_GLUE_RESULT_LOCAL;
+}
+
+static int unistim_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, const struct ast_format_cap *codecs, int nat_active)
+{
+	struct unistim_subchannel *sub;
+	struct sockaddr_in them = { 0, };
+	struct sockaddr_in us = { 0, };
+
+	if (!rtp) {
+		return 0;
+	}
+	
+	sub = ast_channel_tech_pvt(chan);
+	if (!sub) {
+		ast_log(LOG_ERROR, "No Private Structure, this is bad\n");
+		return -1;
+	}
+	{
+		struct ast_sockaddr tmp;
+		ast_rtp_instance_get_remote_address(rtp, &tmp);
+		ast_sockaddr_to_sin(&tmp, &them);
+		ast_rtp_instance_get_local_address(rtp, &tmp);
+		ast_sockaddr_to_sin(&tmp, &us);
+	}
+	
+	/* TODO: Set rtp on phone in case of direct rtp (not implemented) */
+	
+	return 0;
 }
 
 static struct ast_rtp_glue unistim_rtp_glue = {
 	.type = channel_type,
 	.get_rtp_info = unistim_get_rtp_peer,
+	.update_peer = unistim_set_rtp_peer,
 };
 
 /*--- load_module: PBX load module - initialization ---*/




More information about the asterisk-commits mailing list