Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in the logs while looking for contact param when param missing #228

Closed
ovidiusas opened this issue May 8, 2014 · 8 comments
Closed
Assignees
Labels
Milestone

Comments

@ovidiusas
Copy link
Member

Easy to reproduce with the following probe:

xlog("L_NOTICE", "$(ct{param.value,blah})\n");


ERROR:core:parse_params: invalid character, ; expected, found <

This is specific to Contact header only. Trying to retrieve a bogus param from to or from header does not produce an error in the logs.

@ovidiusas ovidiusas added this to the 1.11 milestone May 8, 2014
@ovidiusas ovidiusas added wontfix and removed wontfix labels May 8, 2014
@liviuchircu
Copy link
Member

Ovidiu,

That's because "param.value" requires formatted input. Try using $(ct{nameaddr.params}{param.value,blah})

@ovidiusas
Copy link
Member Author

xlog("L_NOTICE", "$(ct{nameaddr.params}{param.value,blah})\n"); leads to: ERROR:core:parse_param_body: failed to parse quoted string ERROR:core:parse_params: failed to parse param body

@ovidiusas
Copy link
Member Author

The problem is depicted more clearly here:

xlog("L_NOTICE", "$$ct=[$ct]\n");


$var(ct_nameaddr_params) = $(ct{nameaddr.params});


xlog("L_NOTICE", "$$var(ct_nameaddr_params)=[$var(ct_nameaddr_params)]\n");

Leads to the following output:

$ct=["test" sip:test@192.168.2.113:53814;ob;reg-id=1;+sip.instance="urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b"]


$var(ct_nameaddr_params)=[reg-id=1;+sip.instance="urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b]

The last <"> char is lost during the nameaddr.params transformation.

@bogdan-iancu
Copy link
Member

@ovidiusas , according to the RFC3261 grammar , the contact body
["test" sip:test@192.168.2.113:53814;ob;reg-id=1;+sip.instance="urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b"]
is not valid. If display name is present, the URI must be enclosed between angle brackets (see page 227 in the RFC):

Contact = ("Contact" / "m" ) HCOLON
( STAR / (contact-param *(COMMA contact-param)))
contact-param = (name-addr / addr-spec) *(SEMI contact-params)
name-addr = [ display-name ] LAQUOT addr-spec RAQUOT
addr-spec = SIP-URI / SIPS-URI / absoluteURI
display-name = *(token LWS)/ quoted-string

So, the correct format should be :
["test" sip:test@192.168.2.113:53814;ob;reg-id=1;+sip.instance="urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b"]

@ovidiusas
Copy link
Member Author

The formatting was messed up by github :(
Here's the correct header that failed to be parsed

$ct=["test" <sip:test@192.168.2.113:34184;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b>"]
$var(ct_nameaddr_params)=[reg-id=1;+sip.instance="<urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b>]

The header is properly formated:

Contact:"test" <sip:test@192.168.2.113:34184;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:ed409b05-1872-36ee-8ba0-865cb642250b>"

@bogdan-iancu bogdan-iancu self-assigned this May 12, 2014
bogdan-iancu added a commit that referenced this issue May 14, 2014
If the value of the last parameter is a quoted string, we need to include in the len calculation the closing quote too (quotes are not included in the actual value).

Closing #228.
bogdan-iancu added a commit that referenced this issue May 14, 2014
If the value of the last parameter is a quoted string, we need to include in the len calculation the closing quote too (quotes are not included in the actual value).

Closing #228.

(cherry picked from commit cf1ae2a)
bogdan-iancu added a commit that referenced this issue May 14, 2014
If the value of the last parameter is a quoted string, we need to include in the len calculation the closing quote too (quotes are not included in the actual value).

Closing #228.

(cherry picked from commit cf1ae2a)
@bogdan-iancu
Copy link
Member

@ovidiusas , thanks for the hints, I found and fix the bug - it was related to having a quoted value in the last hdr param (problem was in the nameaddr transformation, for "params").

Btw, instead of
$(ct{nameaddr.params}{param.value,blah})
you can simpler do:
$(ct{nameaddr.param,blah})
It is much more efficient :)

@ovidiusas
Copy link
Member Author

Something is not right again (latest 1.11).

        xlog("L_NOTICE", "$$ct=[$ct]\n");
        xlog("L_NOTICE", "$$ct.fields(params)=[$ct.fields(params)]\n");
        xlog("L_NOTICE", "$$(ct{nameaddr.params})=[$(ct{nameaddr.params})]\n");

generates:

$ct=["test" <sip:test@192.168.2.113:46466;transport=TCP>;+sip.ice]
$ct.fields(params)=[+sip.ice]
ERROR:core:pv_printf: no more space for spec value [24][559214942]
ERROR:core:pv_printf: buffer overflow -- increase the buffer size from [4096]...
ALERT:core:do_action: Cannot print xlog debug message

@ovidiusas ovidiusas reopened this May 28, 2014
bogdan-iancu added a commit that referenced this issue May 29, 2014
bogdan-iancu added a commit that referenced this issue May 29, 2014
Closes again #228 .

(cherry picked from commit dd10969)
@bogdan-iancu
Copy link
Member

It was a different case, when the last parameter has no value. It is fixed now. Thanks, Bogdan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants