$ sipua SIPUA, (c) 2000, Columbia University Visit http://www.cs.columbia.edu/~kns10/software/sipua for more information. Unlicensed copy. Contact hgs@cs.columbia.edu for a license. SIP Endpoint: sipua@cisalpino.cs.columbia.edu Server, Listening at 128.59.19.194:5060 Waiting for connections... Type help to get list of commands sipua> Sun Feb 25 14:25:25 EST 2001: Error in ReceiveTCP: Address already in use (125): bind on 5060 Sun Feb 25 14:25:25 EST 2001: Error in ReceiveUDP: Address already in use (125): bind on 5060 This error indicates that sipua could not use 5060 port number. This is possible if some other application (probably another instance of sipua) is using this port number. sipua> quit Exiting Start sipua with -p option to specify another port, other than 5060. $ sipua -p 5070 SIPUA, (c) 2000, Columbia University Visit http://www.cs.columbia.edu/~kns10/software/sipua for more information. Unlicensed copy. Contact hgs@cs.columbia.edu for a license. SIP Endpoint: sipua@cisalpino.cs.columbia.edu Server, Listening at 128.59.19.194:5070 Waiting for connections... Type help to get list of commands sipua>
... sipua> log msgflow on Message Flow log is put on sipua> invite sip:kns10@bourbon Audio tool listening at 53362 Self Session Audio Rx128.59.19.195:53362 (0)pcmu/8000; Calling sip:kns10@bourbon from sip:kns10@marta.cs.columbia.edu Message Flow display starts here. API This Remote | | | | Initiate | | |---------------------------->| | | | | | | | | | INVITE | | |--------------------------->| | | | | | | | | INVITE | | |--------------------------->| | | | The message flow if intermixed with the usual text display messages Call is Rejected by remote 0 Unknown status StopTool: AudioTool is not active | | | | OnCallRejected | | |<----------------------------| | | | | ~MySIPCall() sipua> log msgflow off Put off the message flow display ...
$ cat cmd1.txt invite test@marta.cs.columbia.edu sleep 60 bye sleep 15 exitNote that after the call is terminate using bye it is important to wait for some time before exiting the application using exit. This is needed for some internal thread synchronization. A few seconds a enough.
Also note that you do not need to exit the application. In fact, if the application exists when the command file is completed the sipua returns to normal mode, as if the user executed it by typing the commands. For example, the file makecall.txt places a call and returns the control to the user's terminal to type additional commands for further action.
$ cat makecall.txt set subject This is a test call invite somebody@nowhereNow to run sipua using the command file cmd1.txt
$ sipua -v -f cmd1.txt ...
... A new call indication arrives Incoming call from sip:alice@host1.cs.columbia.edu to sip:bob@cs.columbia.edu Subject is test call from libsip++ accept/reject/noresponse ? reject Rejecting the call... ...
... A new call indication arrives Incoming call from sip:alice@host1.cs.columbia.edu to sip:bob@cs.columbia.edu Subject is test call from libsip++ When prompted to accept or reject, you choose to redirect the call to another address sip:BobWilson@homenetwork.com giving the reason that "I am at home". accept/reject/noresponse ? redirect sip:BobWilson@homenetwork.com I am at home Rejecting the call... ...
... sipua> invite transport=tcp sip:kns10@cs.columbia.edu ...
... sipua> set proxy sip:hostname_or_ipaddress_of_proxy All the subsequent registrations as well as call requests are sent to this proxy. ... sipua> register sip:alice@home.com ... sipua> invite sip:bob@office.com ...
... Set the variable c1 to the contact you desire. sipua> set c1 "Kundan Singh" <sip:kns10@cs.columbia.edu> Now register with this contact. sipua> register contact=[c1] sip:bob@cs.columbia.edu ... You can also specify other registration parameters like from address and expires. This example also shows how to use variable substitutions. Any thing can be defined as a variable, in this case c1. Substitutions happen both for options and arguments of the commands. It must be a whole word. The following does not work. Substitutions must be whole words sipua> set a cs.columbia.edu sipua> register sip:kns10@[a]
$ sipua -v -p 5070 ... Set the proxy address to marta.cs.columbia.edu so that all the subsequent requests are sent to this host irrespective of any other option. sipua> set proxy sip:marta Now register for user kns10@cs.columbia.edu. It takes the default contact of the local host. sipua> register sip:kns10@cs.columbia.edu Registering to server as sip:kns10@cs.columbia.edu at sip:cs.columbia.edu with contact sip:kns10@marta.cs.columbia.edu:5070 ... Registration failed due to unauthorized error. The SIP messages displayed show this 983136990.444 OnRegistrationFailed(): Registration failed--dummy Set the userid and password. If the userid is same as the user part of your local address then you do not need to set the userid. sipua> set userid sip:kns10 sipua> set password mypasswd sipua> register sip:kns10@cs.columbia.edu Registering to server as sip:kns10@cs.columbia.edu at sip:cs.columbia.edu with contact sip:kns10@marta.cs.columbia.edu:5070 ... The log message shows another Unauthorized response, followed by auto-resend of the register with the userid and password credentials. The second registration is successful. ...
An example command file to register with authentication is shown below. Here the user alice registers as sip:alice@wonderland.com with userid as alice and password as mypasswd.
$ cat register.txt set userid alice set password mypasswd register sip:alice@wonderland.com sleep 5 exit $ sipua -v -f register.txt ...
Start sipua at port 5070. $ sipua -p 5070 ... Set the remote address to that of marta so that all the messages are sent to marta. sipua> set proxy sip:marta sipua> invite sip:bob@cs.columbia.edu Calling sip:bob@cs.columbia.edu from sip:alice@host1.cs.columbia.edu Call is Rejected by remote 401 Unauthorized Call was rejected due to unsufficient privileges WWW-Authenticate: Basic realm="cs.columbia.edu" Set your password and try again. Set the userid to BobWilson and password to mypasswd sipua> set userid BobWilson sipua> set password mypasswd sipua> invite sip:bob@cs.columbia.edu Calling sip:bob@cs.columbia.edu from sip:alice@host1.cs.columbia.edu sipua> Call Established Call was successful Accepted by remote ...
Start sipua at default port $ sipua ... A new call indication arrives Incoming call from sip:alice@host1.cs.columbia.edu to sip:bob@cs.columbia.edu Subject is test call from libsip++ When prompted to accept or reject the call, you choose to authenticate the call accept/reject/noresponse ? authenticate The call could not be authenticated since it did not have any userid or password. Can not be authenticated, rejecting ... The caller tries again. Incoming call from sip:alice@host1.cs.columbia.edu to sip:bob@cs.columbia.edu Subject is test call from libsip++ When prompted to accept or reject the call, you choose to authenticate the call again. accept/reject/noresponse ? authenticate The call could not be authenticated although the caller has set the userid and password, but the sipua does not use them unless requested by the callee. Can not be authenticated, rejecting After this the caller's sipua automatically sets the credentials and retries the call, a new call notification is received immediately. ... Incoming call from sip:alice@host1.cs.columbia.edu to sip:bob@cs.columbia.edu Subject is test call from libsip++ This is totally a new call from the callee's perspective, so you must ask for authentication again. accept/reject/noresponse ? authenticate Call is authenticated. At this point sipua re-prompts to accept or reject the call. Although the call is authentication the decision to accept the call lies with the person. accept/reject/noresponse ? accept Accepting the call... ...
The setup involves three files. A command file cmd3.txt which makes a call to the conference address sip:test@marta. The call lasts for 10 minutes and then terminates.
$ cat cmd3.txt invite test@marta sleep 600 bye sleep 15 exitThe file run3.sh uses sipua and cmd3.txt to simulate 20 call attempts with an interval of 2 seconds. It is a shell script.
$ cat run3.sh #!/bin/bash count=5062 xval=1 while true do echo $xval 2>1 1>/dev/null ./sipua -v -f cmd3.txt -n -p $count & count=`expr $count + 2` xval=`expr $xval + 1` sleep 2 if [ $count == 7998 ] then count=5062 fi if [ $xval -gt 20 ] then exit fi doneNote that sipua is started in non-interactive (-n) mode. It uses the SIP port number from 5062 onwards. This is important as no two sipua can use the same port number. Every iteration of the while loop starts a sipua application executing commands from cmd3.txt which makes a call to the conference server. Since sipua is started in the background mode it script run3.sh does not wait for sipua to exit before continuing with the next iteration.
A third script, 1.exp uses the tool expect to log in to different hosts and execute the script run3.sh to simulate 20 calls from each of these hosts.
$ cat 1.exp #!/usr/bin/expect -f set sipuadir "/home/myuserid" set command "run3.sh" while { 1 } { puts -nonewline "Enter host name:" flush stdout gets stdin host if { $host == "exit" } { break } spawn telnet $host expect "login:" send "kns10\n" expect "Password:" send "mypasswdhere\n" send "cd $sipuadir\n" send "$command\n" exec sleep 10 }To run the setup just execute the script 1.exp.
$ ./1.exp ...It will prompt you for the host name. After you enter the hostname it tries to telnet to that host using your preconfigured userid and password, and then it tries to execute the shell script run3.sh.
$ sipua SIPUA, (c) 2000, Columbia University Visit http://www.cs.columbia.edu/~kns10/software/sipua for more information. Unlicensed copy. Contact hgs@cs.columbia.edu for a license. SIP Endpoint: sipua@ind.cs.columbia.edu Server, Listening at 128.59.19.27:5060 Waiting for connections... Type help to get list of commands Set the subject for a call sipua> set subject This is a test call Make a call to a user. Here you have explicitly specified the optional request uri. sipua> invite sip:kundan@cs.columbia.edu sip:kns10@ind.cs.columbia.edu Audio tool listening at 37700 Self Session Audio Rx128.59.19.194:37700 (0)pcmu/8000; Calling sip:kundan@cs.columbia.edu from sip:kns10@cisalpino.cs.columbia.edu sipua> 100 Trying 200 OK Call Established Call is establied now Accepted by remote Remote Session Audio Rx128.59.19.27:38154 (0)/0; Audio tool connecting to 128.59.19.27:38154 Play thread started Record thread started You can start talking now You can query the status of the call any time sipua> ? call Self: sip:kns10@cisalpino.cs.columbia.edu; Remote:sip:kundan@cs.columbia.edu; Active; You decide to terminate the call after sometime sipua> bye Record thread is terminating Play thread is terminating You get an incoming call indication from another user. The remote address and subject is displayed. sipua> Incoming call from sip:hgs@marta.cs.columbia.edu to sip:bob@cs.columbia.edu Subject is This is a test mail accept/reject/noresponse ? accept You chose to accept the call. You could have alternatively rejected, or redirected the call, or demanded an authentication. Remote Session is Audio Rx128.59.19.194:37700 (0)/0; Audio tool listening at 38154 Self Session is Audio Rx128.59.19.27:38154 (0)pcmu/8000; Accepting the call... Audio tool connecting to 128.59.19.194:37700 sipua> Play thread started Record thread started After some time the remote closes the call. You get an indication. Call closed by remote Play thread is terminating Record thread is terminating You can query the status of the user agent server any time sipua> ? ep Endpoint: sipua@cisalpino.cs.columbia.edu Server, Listening at 128.59.19.194:5060
Last updated by Kundan Singh