[asterisk-users] Handle Options Method

Thomas Deillon Thomas.Deillon at smart-telecom.ch
Tue Nov 21 05:45:42 MST 2006


The solution was to put an entry in the extensions.conf
Like this:

[default]
Exten=S,1,hangup()

Thomas Deillon

-----Message d'origine-----
De : asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] De la part de Thomas Deillon
Envoyé : mardi, 21. novembre 2006 13:30
À : Asterisk Users Mailing List - Non-Commercial Discussion
Objet : RE: [asterisk-users] Handle Options Method

Sorry:
Here is my script:

Options.py:

 

#!/usr/bin/python
import md5, sha, time, random, sys, string, os, socket, re, commands
args = sys.argv[1:]
username=252

HOST = args[1]
>From = commands.getoutput('ifconfig %s | awk \'/inet ad/ {split($2,tmp,":"); print tmp[2]}\''%args[0])
uri="sip: %s@%s"%(username,HOST)
realm="asterisk"
PORT = 5060

 
CallID = 400000000 + random.randint(0,2000000)
SeqID = 3000 + random.randint(100,1990)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('',5060))
s.connect((HOST, PORT))
 

msg1 =  "OPTIONS %s SIP/2.0\r\n"%(uri)
msg1 = msg1 + "Via: SIP/2.0/UDP %s:5060;\r\n"%(From)
msg1 = msg1 + "Max-Forwards: 70\r\n"
msg1 = msg1 + "To: <sip:%s@%s>\r\n"%(username,HOST)
msg1 = msg1 + "From: %s <sip:%s@%s>\r\n"%(username,username,From)
msg1 = msg1 + "Call-ID: %s\r\n"%(CallID)
msg1 = msg1 + "CSeq: %s OPTIONS\r\n"%(SeqID)
msg1 = msg1 + "Contact: <sip:%s@%s>\r\n"%(username,From)
msg1 = msg1 + "Accept: application/sdp\r\n"
msg1 = msg1 + "Content-Length: 0\r\n\r\n"
s.send(msg1)

print msg1

dataSip = s.recvfrom(700)
s.close()
tempo= re.split('\\r\\n',dataSip[0])
for i in tempo:
        print i



-----Message d'origine-----
De : asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] De la part de Thomas Deillon
Envoyé : mardi, 21. novembre 2006 13:22
À : Asterisk Users Mailing List - Non-Commercial Discussion
Objet : [asterisk-users] Handle Options Method

Hi,

 

I have an Alteon in test (a sip/rtp load balancer).

This Alteon sends to the asterisk box a "SIP OPTIONS" to know if
asterisk is alive. 

However, asterisk sends me a 404 message and not a response like, for
example, a Thomson (200 + SDP)

 

I wrote a very little script (you can find it at the end of the email)
to send an Options message to asterisk/phones to try.

It works like this: ./Options.py eth0 192.168.1.35(ip of the UA) 

 

Do you know why asterisk send me a 404 message and how can I ask him to
answer correctly?

 

Thanks a lot for your help,

 

Thomas

 

Ps: for more information about the OPTION method:
http://www.ietf.org/rfc/rfc3261.txt ( page 66 and 67 )

 

 

Response of a Thomson:

/-----------------------------------------------------------------------
-----------------------

|           SIP/2.0 200 OK
|           Via: SIP/2.0/UDP 212.147.65.204:5060
|           From: "252"<sip:252 at 192.168.1.35:5060>
|           To: <sip:252 at 192.168.1.35:5060>;tag=c0a80101-23004a
|           Call-ID: 400842155 at 212.147.65.204
|           CSeq: 4660 OPTIONS
|           Contact: <sip:252 at 192.168.1.35:5060;user=phone>
|           Allow:
INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,SUBSCRIBE,NOTIFY,UPDATE,REFER,REGIST
ER,INFO
|           Supported: timer, replaces
|           Accept: application/sdp
|           Content-Type: application/sdp
|           Content-Length: 269
|
|           v=0
|           o=252 2293834 2293834 IN IP4 192.168.1.35
|           s=-
|           c=IN IP4 192.168.1.35
|           t=0 0
|           m=audio 41000 RTP/AVP 8 0 18 4 97
|           a=rtpmap:8 PCMA/8000
|           a=rtpmap:0 PCMU/8000
|           a=rtpmap:18 G729/8000
|           a=rtpmap:4 G723/8000
|           a=rtpmap:97 telephone-event/8000
|           a=fmtp:97 0-1
\-----------------------------------------------------------------------
-----------------------
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


More information about the asterisk-users mailing list