[Serusers] rtpproxy ip

Giovanni Balasso giaso at yahoo.it
Tue Jan 18 11:52:07 CET 2005


Alle 20:12, lunedì 17 gennaio 2005, Greger V. Teigre ha scritto:
> I think maybe this can help you:
> http://lists.iptel.org/pipermail/serusers/2004-November/013540.html
>

Thanks a lot Greger, the patch works very fine and solved my problems!
For anyone who was not lurking the mailinglist in november the patch is not 
easy to retrieve as it was posted as attachment and so snipped from the web 
archives. So I re-post it here in mail text.

-- 
Giovanni Balasso
giaso at yahoo.it


patch for cvs rtpproxy adds option -i, launch 
rtpproxy -l PRIVATEIP -i PUBLICIP
to get audio pass thru NAT and routers, provided by Greger T. Teigre



*** ../rtpproxy_orig/main.c	2004-08-13 21:04:23.000000000 +0200
--- ./main.c	2004-11-17 18:30:32.000000000 +0100
***************
*** 215,220 ****
--- 215,221 ----
  static int umode = 0;			/* UDP control mode */
  static const char *cmd_sock = CMD_SOCK;
  static const char *pid_file = PID_FILE;
+ static char *public_ip = NULL;
  
  /*
   * The first address is for external interface, the second one - for
***************
*** 916,924 ****
      }
      if (lia[0] == NULL || ishostnull(lia[0]))
  	len += sprintf(cp, "%d\n", lport);
!     else
! 	len += sprintf(cp, "%d %s%s\n", lport, addr2char(lia[0]),
! 	  (lia[0]->sa_family == AF_INET) ? "" : " 6");
  doreply:
      if (umode == 0) {
  	write(controlfd, buf, len);
--- 917,931 ----
      }
      if (lia[0] == NULL || ishostnull(lia[0]))
  	len += sprintf(cp, "%d\n", lport);
!     else {
!       if(!public_ip) {
! 	len += sprintf(cp, "%d %s%s\n", lport,  addr2char(lia[0]),
! 		       (lia[0]->sa_family == AF_INET) ? "" : " 6");
!       } else {
! 	len += sprintf(cp, "%d %s%s\n", lport,  public_ip, 
! 		       (lia[0]->sa_family == AF_INET) ? "" : " 6");
!       }
!     }
  doreply:
      if (umode == 0) {
  	write(controlfd, buf, len);
***************
*** 999,1009 ****
  
      dmode = 0;
  
!     while ((ch = getopt(argc, argv, "vf2Rl:6:s:t:r:p:")) != -1)
  	switch (ch) {
  	case 'f':
  	    nodaemon = 1;
  	    break;
  
  	case 'l':
  	    bh[0] = optarg;
--- 1006,1020 ----
  
      dmode = 0;
  
!     while ((ch = getopt(argc, argv, "vf2Rl:6:s:t:r:p:i:")) != -1)
  	switch (ch) {
  	case 'f':
  	    nodaemon = 1;
  	    break;
+ 	case 'i':
+ 	  public_ip=(char*) malloc(strlen(optarg)+1);
+ 	  strcpy(public_ip,optarg);
+ 	  break;
  
  	case 'l':
  	    bh[0] = optarg;
***************
*** 1014,1020 ****
  		bmode = 1;
  	    }
  	    break;
- 
  	case '6':
  	    bh6[0] = optarg;
  	    bh6[1] = strchr(bh6[0], '/');
--- 1025,1030 ----





More information about the sr-users mailing list