[asterisk-dev] AOC in chan_sip
Wolfgang Pichler
wpichler at yosd.at
Mon Aug 6 13:59:23 CDT 2007
Hi all,
as far as i know there is no standard way (no RFC...) to implement AOC (AOC-S, AOC-D and AOC-E) within sip. But there are already some devices out there which does support SIP AOC Messages. I am currently playing with 2 of them.
The first one are snom devices - the are supporting AOC with a special SIP INFO Messages which are getsting described here: http://wiki.snom.com/wiki/index.php/Advice_of_charge_%28AOC%29_in_SIP
The second one are patton gateways - which are using the following SIP INFO Message to transfer the AOC info.
INFO sip:anonymous at 000.000.000.0:5060 SIP/2.0
Via: SIP/2.0/UDP 000.000.000.0:5062;branch=z9hG4bKfb0c15d1d
Max-Forwards: 70
Content-Length: 60
To: sip:anonymous at 000.000.000.0:5060;tag=565aadc2bfc3677
From: sip:0800820300 at 000.000.000.0:5062;tag=2aa3479136cfb29
Call-ID: 6cdcb36f822cc5f42c24c5a40dbe3c21 at 000.000.000.0
CSeq: 667497007 INFO
Supported: timer
Content-Type: application/QSIG
Supported: replaces
User-Agent: Patton SN4638 5BIS UI MxSF v3.2.8.45 00A0BA020142 R4.T 2007-05-28_RFE745 H323 SIP BRI
91a11a0201000201213012a10d810346522ea206810100820101820100
Basicaly the patton gateway does encapsulate the ISDN binary code into a sip info message with Content Type application/QSIG
Now i do want to implement the patton AOC support within the sip channel.
The big question now is - where and how to start...
I have taken a look at the code in chan_sip.c, and i do have some questions about it.
- The iflist linked list - is this a list with all currently open sip dialogs ?
- The do_monitor thread in chan_sip does monitor all currently open dialogs (iflist) and loaded sip peers. It will check if a dialog needs to get destroyed, and so on. So this thread seems to me to be the best starting point.
What i have tried to do is the following - i have added some extra vars to the iflist struct - so that i can remember when i has sent the last SIP INFO aoc Message. In do_monitor i do check the last time against the current time - and if 1 second is over - then the next SIP INFO AOC message will get generated and send. This does already work - but the generated SIP INFO Messages does not seem to be correct.
Here is my code which does generate the SIP INFO Message:
static int sip_send_aocd_to_peer(struct sip_pvt *p)
{
struct sip_request req;
char buf[2048];
reqprep(&req, p, SIP_INFO, 0, 1);
// Insert already generated ISDN binary for testing purpose
snprintf(buf, sizeof(buf), "91a11a0201000201213012a10d810346522ea206810100820101820100");
/* add_header(&req, "AOC", buf);
add_header_contentLength(&req, 0); */
add_header(&req, "Content-Type", "application/QSIG");
add_header_contentLength(&req, strlen(buf));
add_line(&req, buf);
return send_request(p, &req, 1, p->ocseq);
}
this does generate the following sip messages:
INFO sip:101 at 90.146.5.134:5061 SIP/2.0
Via: SIP/2.0/UDP 88.198.158.245:5060;branch=z9hG4bK2a0ddade;rport
From: <sip:031620837999550 at vpbx.yosd.at>;tag=as5f87418c
To: 101 <sip:101 at vpbx.yosd.at:5061>;tag=868274887
Contact: <sip:031620837999550 at 88.198.158.245>
Call-ID: 010D7008-214C-4D45-B75B-F8C6CA2EA09E at 10.200.0.22
CSeq: 102 INFO
User-Agent: Commoveo Cockpit
Max-Forwards: 70
Content-Type: application/QSIG
Content-Length: 58
91a11a0201000201213012a10d810346522ea206810100820101820100
Seems to be quit ok - but want work...
Does anyone here has already tried something like that and can give me a hint about this ?
I am doing something completly wrong here ?
Or - does anyone here already have a working aoc implementation for sip ?
regards,
Wolfgang Pichler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20070806/bf76fd32/attachment-0001.htm
More information about the asterisk-dev
mailing list