Summary:ASTERISK-05203: [patch] Updated OSP support in chan_sip and res_osp
Reporter:Di-Shi Sun (homesick)Labels:
Date Opened:2005-09-30 14:11:48Date Closed:2008-01-15 15:50:09.000-0600
Versions:Frequency of
Environment:Attachments:( 0) three.patch
Description:Asterisk should support inbound OSP call duration limit.

There are two different OSP call duration limits:
1. Asterisk uses OSP protocol to route a call, it sends an OSP AuthReq message to an OSP server, the server sends back an OSP AuthRsp message with a call duration limit (outbound duration limit).
2. Asterisk receives a SIP INVITE message from an OSP enabled device. This INVITE message has a OSP token with a call duration limit (inbound duration limit).
The outbound OSP call duration limit function has been implemented in Asterisk.

This patch implements inbound OSP call duration limit function.
1. Asterisk gets inbound duration limit when it validates the OSP token from a inbound call.
2. Since there is not a channel structure for the call when Asterisk validates the OSP token, a “unsigned int osptimelimit” is add into sip_pvt structure to store this duration limit.
3. After the channel structure is created for the call in handle_request_invite function, the whentohangup element in the channel structure is set to the inbound OSP duration limit.
4. If Asterisk also uses OSP protocol to route this inbound call, it gets an OSP duration limit (outbound duration limit) from OSP AuthRsp message.
5. A new function ast_channel_cmpwhentohangup is provided to compare the outbound duration limit with the whentohangup element in the channel structure.
6. If the outbound duration limit is earlier than whentohangup, the whentohangup is set to the outbound limit.

All the changes (except the ast_channel_cmpwhentohangup function) are for OSP_SUPPORT only.


Disclaimer signed by TransNexus, Inc. 1/27/05
Comments:By: Olle Johansson (oej) 2005-09-30 15:52:40

Please change to

} else {

on one line, instead of two.

By: Di-Shi Sun (homesick) 2005-10-02 13:56:16

The format of if/else has been changed. The new patch has been tested for CVS HEAD 10/2/05.

Please erase the old patch.


By: Olle Johansson (oej) 2005-10-03 09:52:15

Please add documentation on return values in channel.h

By: Di-Shi Sun (homesick) 2005-10-03 12:39:10

This new patch is for three issues.

1.OSP inbound call duration limit issue
Asterisk should support OSP inbound call duration limit.

It changes chan_sip.c, channel.h channel.c, and res_osp.c. The details have been post in the “description” section. The doc about return value of ast_channel_cmpwhentohangup has been added.

2.OSP “UNDEFINED” call ID issue
When Asterisk cannot build a call ID before calling RequestAuthorisation function, it should pass ospvNumberOfCallIds as 0 to RequestAuthorisation function.

It changes res_osp.c. Asterisk will always pass 0 as ospvNumberOfCallIds to RequestAuthorisation function.

3.DeviceInfo issue
Asterisk should pass IP of the previous hop as ospvSourceDevice to RequestAuthorisation function.

It changes chan_sip.c and res_osp.c. A public string “OSPPEER” variable is add into channel. It is the peer’s IP. ast_osp_lookup function reads it and pass it as ospvSourceDevice to RequestAuthorisation function.

Since the three issues change the same places, we post them together. Except the ast_channel_cmpwhentohangup function, other changes are only for OSP_SUPPORT.

Please remove the old patch.


By: Olle Johansson (oej) 2005-10-03 12:47:56

Kevin, you need to review the ast_whentohangup and make sure it's generic enough. Otherwise I am fine with this patch since it only changes the OSP part of chan_sip...

By: Kevin P. Fleming (kpfleming) 2005-10-04 19:33:20

Committed to CVS HEAD, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:50:09.000-0600

Repository: asterisk
Revision: 6721

U   trunk/channel.c
U   trunk/channels/chan_sip.c
U   trunk/include/asterisk/channel.h
U   trunk/res/res_osp.c

r6721 | kpfleming | 2008-01-15 15:50:08 -0600 (Tue, 15 Jan 2008) | 2 lines

support call duration limits on inbound OSP calls (issue ASTERISK-5203)