How to make several connections from one IP
Description
Sometimes it is necessary to make several connections from one IP (server usually) to MOR to separate traffic.
Main rules how to do that:
- Devices should be DYNAMIC and should REGISTER to MOR
- In INVITE packet from external server in line From: should be visible, which device is dialing. (If external server is Asterisk, then in MOR descriptions (in sip.conf file) on external server, should be fromuser= lines which points which device is dialing - check explanation in details below)
If devices are not configured properly, then call from external server to MOR is possible, but only 1 device will be billed all the time or only 1 trunk will be active (depends on 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 correct SIP INVITE packet should be received in order for MOR to correcly authenticate user.
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
Lets say we have MOR and another Asterisk server from which we want to configure 2 connections to MOR.
MOR configuration
First on MOR we need to describe such connections as Devices for different Users.
We will create 2 devices 1028 and 1009 for these connections:
(Important parts are marked in RED)
Remote server configuration
Remote server in our example is Asterisk, so such 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 remote setver this way because fromuser overwrites CallerID field.
You can only hardcode CallerID in MOR for every user account.