Override pjsip.identify.conf


(Miro Igov) #1

Hello, our voip provider does not maintain SRV records for it’s sip server. SRV addresses differ from A IPs and provider said we must use IP addresses defined in A record.
However i can not make Freepbx 14.0.13.12 respect A records instead of SRV.
I want to add srv_lookups=no to the identify section.

Currently in pjsip.identify.conf i have this content:

;--------------------------------------------------------------------------------;
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
;--------------------------------------------------------------------------------;
; For information on adding additional paramaters to this file, please visit the ;
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
; is totally deliberate.                                                         ;
;--------------------------------------------------------------------------------;
#include pjsip.identify_custom.conf

[ovh-0724]
type=identify
endpoint=ovh-0724
match=sip5.ovh.fr

[mixvoip]
type=identify
endpoint=mixvoip
match=ipx.mixvoip.com

If i override in pjsip.identify_custom.conf i get error:

[mixvoip]
type=identify
endpoint=mixvoip
match=ipx.mixvoip.com
srv_lookups=no

After fwconsole restart i get this error in asterisk log:
ERROR[26611] res_sorcery_config.c: Config file ‘pjsip.conf’ could not be loaded; configuration contains a duplicate object: ‘ovh-0724’ of type ‘identify’

And then identify is empty for both trunks.

Any suggestion how to override phsip.identify.conf? Or is there a setting in Freepbx GUI so i can disable srv_lookups ?


#2

The right way to do an override or add extra parameters to a block is to use pjsip.identity_custom_post.conf (not pjsip.identity_custom.conf) and use syntax like this:

[mixvoip](+type=identify)
srv_lookups=no

this takes the existing [mixvoip] block that FreePBX creates and adds the srv_lookups=no parameter to it. You do not have to redefine the whole block.


(Miro Igov) #3
ERROR[24247] config_options.c: Could not find option suitable for category 'mixvoip' named 'srv_lookups' at line 2 of /etc/asterisk/pjsip.identify_custom_post.conf
ERROR[24247] res_sorcery_config.c: Could not create an object of type 'endpoint' with id 'mixvoip' from configuration file 'pjsip.conf'

(Miro Igov) #5

Please note there are multiple [mixvoip] sections defined in :slight_smile:

pjsip.identify.conf:[mixvoip]
pjsip.registration.conf:[mixvoip]
pjsip.endpoint.conf:[mixvoip]
pjsip.aor.conf:[mixvoip]
pjsip.auth.conf:[mixvoip]

Should i add type=identify somewhere?


(Lorne Gaetz) #7

My experience is that doing custom includes of existing pjsip contexts sometimes works and sometimes doesn’t, due to the fact that the context names are reused for the various types. I have not found a method to modify an existing identify.

edit - it does work, see above.


(Miro Igov) #8

Why there are the *_custom.conf files if they can not override the GUI settings?

I would like if possible using pjsip.identify_custom.conf and enter all the contexts from pjsip.identify.conf and modifying what i want but this throws error no matter _custom.conf is included before the .conf content.

Is there a documentation about overriding .conf files in freepbx ?


#9

The SIP way to do this would be to put the hostname (“A” record) followed by the port. e.g. ipx.mixvoip.com:5060. Specifying the port bypasses SRV lookup. I do not know whether this would work here.

Anyway, it’s not a long list (I see seven IP addresses in the A record), so you could just list them out.


(Joshua C. Colp) #10

The configuration parser has functionality to limit things so it works as expected, example:

[mixvoip](+type=identify)

That looks for a section called “mixvoip” and then requires “type=identify” to be set in it to be considered.


#11

Ooooh! Where has this secret been hiding? This is great.


(Joshua C. Colp) #12

The wiki[1]? :smiley:

[1] https://wiki.asterisk.org/wiki/display/AST/Adding+to+an+existing+section


#13

Just added October 3: https://wiki.asterisk.org/wiki/pages/diffpages.action?originalId=42565866&pageId=42565868

I was wondering how I missed this before.

I’m glad for this!

edit: Updated the answer above to reflect new information.


(Joshua C. Colp) #14

Shhhhhhhh, don’t look at the history behind the present.


(Lorne Gaetz) #15

OMG this is beautiful. Christmas comes early this year!


(Miro Igov) #16

@jcolp , did you invented FreePBX?

It is working perfect:

voip*CLI> pjsip show identify mixvoip

 Identify:  <Identify/Endpoint...........................................................>
      Match:  <criteria...........................>
==========================================================================================

 Identify:  mixvoip/mixvoip
      Match: 185.125.183.7/32


 ParameterName : ParameterValue
 =============================================
 endpoint      : mixvoip
 match         : 185.125.183.7/255.255.255.255
 match_header  :
 srv_lookups   : false

@billsimon , i can’t add static number of IPs as they may change. It’s a cloud service. They add the live IP addresses in A record with very short TTL.

I wonder if asterisk respects TTL and periodically update identify IPs if DNS changes.


(Joshua C. Colp) #17

I work on Asterisk.

As for the identify section respecting TTL, it does not currently.


(Miro Igov) #18

Changing the A records in DNS server will not automatically update identify?
Any workaround ? Shortening the expiration time?


(system) closed #19

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