How to make several connections from one IP
Description
In order to separate traffic, it is sometimes necessary to make several connections to MOR from one IP (usually a server).
The main rules for how to do this are:
- Devices should be DYNAMIC and should REGISTER to MOR.
- In the INVITE packet from the external server, which device is dialing should be visible in the From: line. (If the external server is Asterisk, then in the MOR descriptions (in sip.conf file) on the external server, there should be fromuser= lines that point to which device is dialing. Check explanation in details below).
If the devices are not configured properly, then a call from external server to MOR is possible, but only one device will be billed all the time or only one trunk will be active (it depends on the misconfiguration).
Possible error on misconfiguration:
WARNING[2836]: chan_sip.c:8385 check_auth: username mismatch, have <XXXX>, digest has <YYYY>
SIP INVITE packet
As described previously, the correct SIP INVITE packet should be received in order for MOR to authenticate the user correctly.
Good SIP INVITE packet
INVITE sip:3908155xxxxx@82.215.xxx.xxx SIP/2.0 Via: SIP/2.0/UDP 82.215.xxx.xxx:5060;branch=z9hG4bK50ef8b9b;rport From: "39081761xxxxx" <sip:1028@82.215.xxx.xxx>;tag=as3b117c95 To: <sip:390815517304@82.215.xxx.xxx> Contact <sip:1028@82.215.xxxx.xxx> Call-ID: 2f6f09f8498065164a9aadae5ef123cf@82.215.xxx.xxx CSeq: 102 INVITE User-Agent: Asterisk PBX Max-Forwards: 70 Date: Fri, 19 Feb 2010 12:28:03 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY Content-Type: application/sdp Content-Length: 242
Bad SIP INVITE packet
INVITE sip:3908155xxxxx@82.215.xxx.xxx SIP/2.0 Via: SIP/2.0/UDP 82.215.xxx.xxx:5060;branch=z9hG4bK7edd0b9e;rport From: "3908176xxxxx" <sip:3908176xxxxx@82.215.xxx.xxx>;tag=as1b7e883e To: <sip:3908155xxxxx@82.215.xxx.xxx> Contact: <sip:3908176xxxxx@82.215.xxx.xxx> Call-ID: 1efdd14505519d1a6b769e5c269f555d@82.215.xxx.xxx CSeq: 103 INVITE User-Agent: Asterisk PBX Max-Forwards: 70 Proxy-Authorization: Digest username="1028", realm="asterisk", algorithm=MD5, uri="sip:3908155xxxxx@82.215.xxx.xxx", nonce="0f96c765", response="df7b502821c03ad43222d007b20dbf84", opaque="" Date: Fri, 19 Feb 2010 12:17:41 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY Content-Type: application/sdp Content-Length: 242
Example
Let's say we have MOR and another Asterisk server from which we want to configure two connections to MOR.
MOR configuration
First, on MOR we need to describe such connections as Devices for different Users.
We will create two devices, 1028 and 1009, for these connections:
(Important parts are marked in RED)
Remote server configuration
The remote server in our example is Asterisk, so its configuration should be in sip.conf file, which describes both connections and registers to MOR:
[general] register => 1028:ewpjxxxx@82.215.xxx.xxx/1028 register => 1009:ca5hxxxx@82.215.xxx.xxx/1009 [authentication] [mor1028] canreinvite=no host=82.215.xxx.xxx user=1028 username=1028 secret=ewpjxxxx type=peer fromuser=1028 [mor1009] canreinvite=no host=82.215.xxx.xxx user=1009 username=1009 secret=ca5hxxxx type=peer fromuser=1009
Limitations
It is not possible to send CallerID from a remote server this way, because "fromuser" overwrites the CallerID field.
You can only hardcode CallerID in MOR for every user account.