balena/elixir-sippet

{:error, {:error, :multiple_definition}}

blackham opened this issue · 4 comments

I am seeing some SIP traffic with two P-Asserted-Identity fields

...
P-Asserted-Identity: <sip:5554443333@ims.mnc000.mcc777.3gppnetwork.org;user=phone;cpc=ordinary>
P-Asserted-Identity: <tel:5554443333;phone-context=+55;cpc=ordinary>
...

It looks like the RFC allows one SIP and one TEL P-Asserted-Identity.

https://www.ietf.org/rfc/rfc3325.txt
If there is no P-Asserted-Identity header field present, a proxy MAY
add one containing at most one SIP or SIPS URI, and at most one tel
URL.

Same issue with the "Reason" field.

https://www.ietf.org/rfc/rfc3326.txt
A SIP message MAY contain more than one Reason value (i.e., multiple
Reason lines), but all of them MUST have different protocol values
(e.g., one SIP and another Q.850).

...
Reason: X.int;reasoncode=0x0000030A;add-info=068C.0001.0001
Reason: SIP;cause=200;text="Call Rejected By User"
...
balena commented

As I remember, the SIP message parser considers every header it does not know as appearing just once in the message.

So it would be simple to extend the SIP message parser to accept these headers as a list of strings or parse other details if preferred.

balena commented

Just checked: c_src/headers_list.h states Reason header is a SingleTokenParams header. It should be changed to MultiTokenParams instead.

Fixed both cases in 1.0.16