[asterisk-dev] Query about getting peer information in chan_sip.c

Chan Kwang Mien kwangmien at asgent-tech.com
Fri Jun 29 02:23:42 CDT 2007


sipphone A -> Asterisk -> sipphone B

in the case of sip, the channel driver is chan_sip. when a call is made
from sipphone A, the function that receives SIP messages is
sipsock_read(...) in chan_sip.c. In this function, depending on what type
of message, the function will be executed. for e.g. INVITE is handled by
handle_request_invite(...). Calls made from PBX are done using
sip_call(...). so, sip_call(...) sends an INVITE to sipphone B. When
Asterisk receives 200 OK from sipphoneB, sip_answer(...) sends 200 OK to

Kwang Mien

> Hi,
>       Chan,how are you. Can u help me to understand the overall
> functionality of the asterisk, i have started reading  the asterisk code
> but
> i do not understand which function  is calling to which function. i know
> that there are channel drivers,and many .c files which contain all
> function
> definitions. Ok the program starts at asterisk.c file, but after that what
> happens. suppose sipsoft phone A is registered to asterisk and another
> softphone B is also registered to asterisk.suppose now A calls to B, which
> function in asterisk receives the invite message sent by phone A, and what
> actually a channel driver does.
> On 6/29/07, Chan Kwang Mien <kwangmien at asgent-tech.com> wrote:
>> Hi,
>> I am trying to get peer information in chan_sip.c for the following
>> scenario :
>> Phone A -> Asterisk_1 -> Asterisk_2 -> Phone B
>> Asterisk_1 is registered to Asterisk_2.
>> When Asterisk_1 receives INVITE from Phone A, Asterisk_1 sends the
>> to Asterisk_2. I understand that sip_call(...) is called when the INVITE
>> is sent at Asterisk_1.
>> At the point in time when INVITE is sent by Asterisk_1, I would like to
>> find out who the originator of the INVITE is in sip_call(...).
>> Is there a way I could get this information, in this case, Phone A's
>> extension in sip_call(...) ?
>> Thank you.
>> Regards,
>> Kwang Mien
>> _______________________________________________
>> --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