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:[EMAIL PROTECTED]:5060 SIP/2.0
Via: SIP/2.0/UDP 000.000.000.0:5062;branch=z9hG4bKfb0c15d1d
Max-Forwards: 70
Content-Length: 60
To: sip:[EMAIL PROTECTED]:5060;tag=565aadc2bfc3677
From: sip:[EMAIL PROTECTED]:5062;tag=2aa3479136cfb29
Call-ID: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]:5061 SIP/2.0
Via: SIP/2.0/UDP 88.198.158.245:5060;branch=z9hG4bK2a0ddade;rport
From: <sip:[EMAIL PROTECTED]>;tag=as5f87418c
To: 101 <sip:[EMAIL PROTECTED]:5061>;tag=868274887
Contact: <sip:[EMAIL PROTECTED]>
Call-ID: [EMAIL PROTECTED]
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
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

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

Reply via email to