# PJSIP: 2 wan same isp sip provider

**URL:** <https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830>\
**Category:** Asterisk Support\
**Created:** [May 28, 2016, 12:32pm UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830 "2016-05-28T12:32:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![manuel989](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@manuel989](https://community.asterisk.org/u/manuel989)\
**Post date:** [May 28, 2016, 12:32pm UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/1 "2016-05-28T12:32:26Z")

</div>

Hi,  
i’m new in this community, i’ve a trouble with a inbound configuration with pjsip.

I’ve the same pjsip trunk registration over 2 wan (for a failover dls isp) .  
All works ok with outbound call but with inbound i’ve a problem :

- when isp provides are online incoming call is ok
- when the second wan is going down it’s all ok
- when the first wan is going down incoming call doesn’t work

The problem is the the match variable inside pjsip.identity configuration :

[isp\_wan1]  
type=identify  
endpoint=isp\_wan1  
match=same\_sip\_provider

[isp\_wan2]  
type=identify  
endpoint=isp\_wan2  
match=same\_sip\_provider

More debugging i see that module res\_pjsip\_endpoint\_identifier\_ip.so match only the first occurence without see the endpoint registration status ( i think if endpoint registration status is down go to second occurence ).

Module res\_pjsip\_endpoint\_identifier\_user.so it’s it’s inusable , take only the From header of invite.  
In invite there is one another string on the fist line :

INVITE sip:isp\_wan1@myip:5061 SIP/2.0

There is a solution to use INVITE sip uri header instead from sip uri header ?

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 30, 2016, 10:59am UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/2 "2016-05-30T10:59:41Z")

</div>

The identify section matches on source IP address only without regard to anything else (including endpoint status as it shouldn’t matter). It’s not made to match like how you are needing, none of the endpoint identifiers currently are. You would need to continue to use the IP based matching and parse in the dialplan using PJSIP\_HEADER or write your own endpoint identifier.

---

<div class="post-metadata">

**Author:** ![manuel989](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@manuel989](https://community.asterisk.org/u/manuel989)\
**Post date:** [May 30, 2016, 12:10pm UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/3 "2016-05-30T12:10:11Z")

</div>

ok for dialplan PJSIP\_HEADER , but the problem is the rtp media server ( identify -\> endpoint ).

if on the endpoint configuration i’ve this :  
[isp\_wan1]  
media\_address=public\_ip\_isp\_wan1  
bind\_rtp\_to\_media\_address=yes

[isp\_wan2]  
media\_address=public\_ip\_isp\_wan2  
bind\_rtp\_to\_media\_address=yes

The call is entering on the endpoint that match identify and use the media\_address of endpoint.  
If the isp\_wan1 on the endpoint is down and the call is entering from isp\_wan2 (first match from pjsip match on the identify section isp\_wan1 ) , it can’t inizialize the rtp flow between asterisk and the sip provider.

There is a function on dialplan to change the rtp media address? 😅

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 30, 2016, 2:55pm UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/4 "2016-05-30T14:55:04Z")

</div>

No, there isn’t. Asterisk can’t do exactly what you need with what exists right now.

---

<div class="post-metadata">

**Author:** ![manuel989](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@manuel989](https://community.asterisk.org/u/manuel989)\
**Post date:** [May 30, 2016, 6:48pm UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/5 "2016-05-30T18:48:34Z")

</div>

ok if i wanna rewrite res\_pjsip\_endpoint\_identifier\_user.c for matching invite sip uri vs from sip uri is there some kind of guide for dev or is it too nasty thing ? 😛  
This endpoint identify “plugin” is good for internal user but for trunking is nosense.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 30, 2016, 8:24pm UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/6 "2016-05-30T20:24:35Z")

</div>

There’s no guide or anything. You get a request and then it’s up to you to determine what endpoint it came from. As for trunking - I disagree, just because it’s not useful for exactly what you need doesn’t mean it’s nonsense. The IP based one is in use for ITSP matching for quite a few people. What’s different is that you are doing failover and need to determine not just who it is from - but where it came in on.

---

<div class="post-metadata">

**Author:** ![manuel989](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@manuel989](https://community.asterisk.org/u/manuel989)\
**Post date:** [May 31, 2016, 9:08am UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/7 "2016-05-31T09:08:47Z")

</div>

Ok thanks for explanation and suggestion.  
There is a chance for a future endpoint identify module doing this?  
I’m following asterisk from 1.2 release you are doing a great job!

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 31, 2016, 10:11am UTC](https://community.asterisk.org/t/pjsip-2-wan-same-isp-sip-provider/66830/8 "2016-05-31T10:11:25Z")

</div>

I can’t speak for anyone writing such a thing for your use case, but if one were put up for review it could certainly go in if it passed code review.
