Help - Trying to add SIP extensions to PJSIP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 3, 2011 at 8:14 PM, Thomas Tavaris J (Tavaris)
<tjthomas at lgsinnovations.com> wrote:
> Hello members,
>
> I apologize for repeated requests but I have not heard from anyone. Surely
> someone has experienced my situation.
> I am trying to parse a SIP Instant Message. The Instant Message (Method:
> MESSAGE) header contains the field Proxy-Authorization: ?NTLM
>
> And the 200 OK reply header contains the field Authentication-Info: NTLM
>
> Both of these packets in my program cause the pjsip_parse_msg function to
> return NULL and generate PJSIP syntax error. I?ve looked through the
> documentation (Developer Guide) The authentication header provided in PJSIP
> does not support NTLM(which is fine) I just want to my add a custom header.
>
> 1. Based on the information in the guide I think I need to tell the endpoint
> to support a new header correct?
>
> 2. I have to create a new header ?struct based on the two fields mentioned
> above that I want to capture in instant message
>
> 3. I then have to extend the parser to support new types of headers?
>
> Are there any steps I?m missing?
>
>

Actually those aren't the right steps. The parser for
"Proxy-Authorization" is already registered by sip_auth_parser.c,
hence any subsequent attempt to register the parser for the same
header will fail with assertion.

So instead of registering a parser, what you need to do is to extend
the existing "Proxy-Authorization" parser and its friends.
Unfortunately pjsip does not have plug-in mechanism for this kind of
customization, so you'd have to modify the various sip_auth_xxx files
for this. The existing code supports both "basic" and "digest", so
adding "ntlm" shouldn't be too difficult. Note that I'm only talking
about supporting it syntactically, not performing the actual NTLM
auth.


> ?Things get even more confusing when reading section 4.3 of developers guide
> as this isn?t clear:
> typedef pjsip_hdr* (pjsip_parse_hdr_func)(pjsip_parse_ctx *context);
> pj_status_t pjsip_register_hdr_parser( const char *hname,
> const char *hshortname,
> pjsip_parse_hdr_func *fptr);
>
> Register new function to parse new type of SIP message header. There no
> clear examples of how to tie these things together or if I am missing
> something at all. I?ve grep?d through the PJSIP source to see examples of
> how to implement something similar but I am stuck. Could someone please
> advise???
>

I'm not sure what you mean. The pjsip source code is full of header
parsers that you can use as sample, just have a look at sip_parser.c?

Cheers
 Benny



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux