[asterisk-dev] AOC in chan_sip

Ibrar Ahmed ibrar.ahmad at gmail.com
Tue Aug 7 07:49:35 CDT 2007


I think code should look like this

typedef struct
{
    char* charging_info;         /* Chraging information like "currency" */
    char* charging_info_val;   /* Charging information value like 
currency = USD */
    float amount;                     /* Amount to charge */   
    float multiplier;                 /* Multiplier */
}aoc;

/*! \brief Transmit SIP AOC unreliably */
static int transmit_sip_aoc(struct sip_pvt *p)
{
        struct sip_request req;
        char aocs[255]; /* String to hold value of aoc */

        reqprep(&req, p, SIP_INFO, 0, 1);
        add_header(&req, "Content-Type", "application/QSIG");
        snprintf(aocs, sizeof(aocs),
                    "charging;state=active\
                    \n charging-info=%s\
                    \n currency=%s\
                    \n amount=%f\
                    \n 
multiplier=%f",p->aoc.charging_info,p->aoc.charging_info_val,p->aoc.amount,p->aoc.multipier);

        add_header(&req, "AOC",aocs);
        add_header_contentLength(&req, 0);
        return send_request(p, &req, 1, p->ocseq);
}

Ibrar Ahmed wrote:
>
> Hi  Wolfgang,
>
>
>
>>
>> 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
>>
>>
> Why are you not using AOC as mentioned in site " 
> http://wiki.snom.com/wiki/index.php/Advice_of_charge_%28AOC%29_in_SIP"
>
> INFO sip:bla at snom.com SIP/2.0
> From: <biller at snom.com>;tag=5354n3
> To: <ua at snom.com>;tag=33rfh3
> CSeq: 23423 INFO
> Call-ID: 3452tw43dt354dm03
> AOC: charging;state=active;
>  charging-info=currency;
>  currency=EUR;
>  amount=2000;
>  multiplier=0.001
> Content-Length: 0
>
>> Seems to be quit ok - but want work...
>>
> What do you mean it wont work(whats error reported)
>
>
> Sorry if I understand your question wrong. -:(
>
>   --ibrar
> ------------------------------------------------------------------------
>
> _______________________________________________
> --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




More information about the asterisk-dev mailing list