Label : log

sip / six digit port number / invalid

By | | Tech | Schrijf als eerste een commentaar!

While looking through opensips logs of a customer, sometimes we would see the following:

ERROR:core:parse_via:  invalid port number <110900>
ERROR:core:parse_via:  <SIP/2.0/UDP 1.2.3.4:110900;branch=z9hG4bKabcdef...
ERROR:core:parse_via: parsed so far:<SIP/2.0/UDP 1.2.3.4:110900;branch=z9hG4bKabcdef...
ERROR:core:get_hdr_field: bad via

As you can see, that 6-digit port number is invalid. Furthermore, when sniffing this traffic, we could see that the port number is almost right. The traffic came from port 11090 (one less zero at the end).

Not only the Via header, the ...

asterisk dialplan peculiarities / regex with eqtilde

By | | Tech | Schrijf als eerste een commentaar!

In the Asterisk PBX dialplan, expressions can be formed using the $[...] syntax. Addition, subtraction, comparison and so on are defined. As is a regex operator: =~

Unfortunately, the documentation about the details of the implementation is hard to find.

Here, a breakdown of my findings:

  • static struct val * op_eqtilde is defined in main/ast_expr2.y
  • It uses the REG_EXTENDED flag when calling regcomp: so extended regular expression syntax is used.
  • The REG_ICASE flag is NOT used: case sensitive.
  • If you don't use parentheses (substring addressing) the returned value is the amount of characters that match: rm[0].rm_eo - rm[0 ...