[Asterisk-Dev] patch for MGCP adding option canreinvite like in SIP

Pavel Litvinenko litw at krypton.ru
Tue Jul 15 05:52:45 MST 2003


This patch helps me to prevent modify rtp stream to perr-to-peer  when 
one gateway are in private address space ...

mgcp.conf:

[gw]
...
canreinvite=no
line=>aaln/1

-- 
----
---------
Best Regards,
     Pavel Litvinenko.
     ICQ: 16224754
     Ph: (8632) 923962, 923640
     sip:litw at iptel.org


-------------- next part --------------
Index: chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.14
diff -u -r1.14 chan_mgcp.c
--- chan_mgcp.c	29 Jun 2003 14:36:21 -0000	1.14
+++ chan_mgcp.c	15 Jul 2003 12:57:16 -0000
@@ -51,6 +51,7 @@
 #define MGCPDUMPER
 #define DEFAULT_EXPIREY 120
 #define MAX_EXPIREY     3600
+#define CANREINVITE	1
 
 static char *desc = "Media Gateway Control Protocol (MGCP)";
 static char *type = "MGCP";
@@ -119,6 +120,8 @@
 
 static int cancallforward = 0;
 
+static int canreinvite = CANREINVITE;
+
 /*static int busycount = 3;*/
 
 /*static int callprogress = 0;*/
@@ -257,6 +260,7 @@
     int transfer;
     int threewaycalling;
 	int cancallforward;
+	int canreinvite;
 	int callreturn;
 	int dnd; /* How does this affect callwait?  Do we just deny a mgcp_request if we're dnd? */
 	int hascallerid;
@@ -2613,7 +2617,7 @@
     struct mgcp_subchannel *sub;
     /*char txident[80];*/
     int i=0, y=0;
-
+	canreinvite = CANREINVITE;
 	gw = malloc(sizeof(struct mgcp_gateway));
 	if (gw) {
 		memset(gw, 0, sizeof(struct mgcp_gateway));
@@ -2683,6 +2687,8 @@
                 immediate = ast_true(v->value);
             } else if (!strcasecmp(v->name, "cancallforward")) {
                 cancallforward = ast_true(v->value);
+            } else if (!strcasecmp(v->name, "canreinvite")) {
+                canreinvite = ast_true(v->value);
             } else if (!strcasecmp(v->name, "mailbox")) {
                 strncpy(mailbox, v->value, sizeof(mailbox) -1);
             } else if (!strcasecmp(v->name, "adsi")) {
@@ -2728,6 +2734,7 @@
                     e->pickupgroup=cur_pickupgroup;
                     e->callreturn = callreturn;
                     e->cancallforward = cancallforward;
+                    e->canreinvite = canreinvite;
                     e->callwaiting = callwaiting;
                     e->transfer = transfer;
                     e->threewaycalling = threewaycalling;
@@ -2793,7 +2800,7 @@
 {
 	struct mgcp_subchannel *sub;
 	sub = chan->pvt->pvt;
-	if (sub && sub->rtp)
+	if (sub && sub->rtp && sub->parent->canreinvite)
 		return sub->rtp;
 	return NULL;
 }


More information about the asterisk-dev mailing list