Looking for a developer: for adding headers/body part in registration

Hi

Asterisk doesnt have a method to add extra headers/body on an outbound registration/trunk
I’m looking for someone who can help me with that
I know opensips can do it, i use these functions for it:

https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_add_body_part
https://opensips.org/html/docs/modules/3.2.x/sipmsgops.html#func_append_hf

thx in advance

What extra headers do you need to add?

It’s an extra body part, see example below…
Are you a dev?

REGISTER sip:10000000002@192.168.0.71:5065 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.72:5060;rport;branch=z9hG4bK870856495
From: Room 2 <sip:10000000002@192.168.0.72>;tag=588337480
To: Room 2 <sip:10000000002@192.168.0.72>
Call-ID: 1549082696
CSeq: 2 REGISTER
Contact: <sip:10000000002@192.168.0.72:5060;line=39b237d1561ac46>
Authorization: Digest username="10000000002", realm="XXX", nonce="710ae2f3adf7446b6ea068ed6cede929", uri="sip:10000000002@192.168.0.71:5065", response="78e1b60cb438905bdaf010e680d06734", algorithm=MD5, opaque="9c77d2882f5d8f3fb72f307e3da4d76d"
Content-Type: text/xml
Max-Forwards: 70
User-Agent: eXosip/3.6.0
Expires: 900
Content-Length:   165

<regXML>
<version>V2.0.0</version>
<regDevName>Rooom</regDevName>
<regDevSerial>Qxxxx</regDevSerial>
<regDevMacAddr>2c:a5:xx:xx:xx</regDevMacAddr>
</regXML>

I’d have a look at Kamailio. With Asterisk you’d probably have to change and then maintain and maintain and maintain… the source code. Kamailio allows the direct manipulation of SIP headers. I would start with using Kamailio as a stateful proxy server that does not do anything with the media, just the signalling.

Yes, I always use opensips for that, it’s the same as kamailio… But it’s a bit overkill, just for that…
Don’t care about maintaining, I don’t think it’s so much of a code change anyway

Adding extra SIP headers is not the problem, but you are adding a payload where there is usually none. I don’t think that you can do that without touching the source code. If I had to do something like that, I’d first check whether the pjsip lib can do that at a higher level and then see what has to be added to Asterisk.

In the end there could be something like PJSIP_PAYLOAD() which would work similarly like PJSIP_HEADER(). I think this can be done, but the problem is that the dialplan does not interact with the registration process. I could be wrong, but something like a “registration hook” would be needed.

Ok, it’s a little bit more then a few lines :+)

I don’t even care, it can be hardcoded, I had a look at the pjsip_outboudregistration.c file , but I could find anything there where I could hardcode it

I think Asterisk is conceptionally the wrong place to do that. A SIP proxy/SBC would be the better place. I have a couple of other scenarios where Asterisk is not flexible enough (like registering to multiple proxies of a provider at the same time (works actually with some…)). A SIP server deals with individual SIP messages and the way they are related, Asterisk operates basically at the higher phone call level. I think the SIP server would not be overkill, but the fact that one now has to understand the SIP protocol…

ok, maybe i stick then with opensips/kamailio :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.