Navigation



Ignore:
Timestamp:
Jul 28, 2010, 4:17:29 PM (14 years ago)
Author:
Alexandre Westfahl <awestfahl@freediameter.net>
Branch:
default
Phase:
public
Message:

Added dynamic port choice for app_sip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_sip/tools/app_sip_rtr.c

    r433 r440  
    4848#include <stdlib.h>
    4949#include <string.h>
    50 #define PORT 666
    5150#include <errno.h>
    5251
     
    6867    struct rtrsipaor rtrsip;
    6968    int numaor=0,i=0;
    70    
     69        int port=666;
     70       
    7171        sock = socket(AF_INET, SOCK_STREAM, 0);
    7272        sin.sin_addr.s_addr = inet_addr("127.0.0.1");
    7373    sin.sin_family = AF_INET;
    74     sin.sin_port = htons(PORT);
     74   
    7575   
    7676    //We initialize the structure
     
    215215                                rtrsip.reason=3;
    216216                        }
     217                        else if(strcmp(argv[i],"-p")==0)
     218                        {
     219                               
     220                                if(sscanf(argv[i+1],"%d", &port)!=1)
     221                                {
     222                                        fprintf(stderr,"Incorrect port number!\n");
     223                                        return 1;
     224                                }
     225                               
     226                               
     227                                i++;
     228                        }
    217229                        else
    218230                        {
     
    247259        }
    248260   
    249    
     261    //We set the port number
     262    sin.sin_port = htons(port);
    250263   
    251264   
Note: See TracChangeset for help on using the changeset viewer.