[OpenSIPS-Users] Call from Asterisk to Opensips

Duong Manh Truong ngoahotanglongbk at gmail.com
Sun May 8 16:06:58 CEST 2011


To Mark Sayer:
My setup is
I. For the direction from Opensips to Asterisk

1. Asterisk: Creat a sip trunk to Opensips server
type=friend
insecure=very
host=10.2.14.122
context=from-internal
allow=all
qualify=yes
fromdomain=10.2.14.122
username=1000
fromuser=1000
secret=1000

(1000/1000 is one of the extension defined in Opensips server)

2. Opensips:
- Insert ip of asterisk server to "address" table of "opensips" database
- Add following lines in "opensips.conf"
 #route to PSTN
       if ($rU=~"^9")
        {
      route(4);
      exit;
  }
 #forward call to asterisk server (gateway)
    route[4]
{
rewritehostport( "192.168.19.6:5060");
     route(1);
}
- Configure 1001 extension into the group ld ("grp" table)
1100110.2.14.122ld2011-03-19 08:00:160*NULL*1*NULL*

3. Dial: 9. from Opensips  (1001) to Ast ok
May  5 15:39:48 opensips /usr/sbin/opensips[6300]: new branch at
sip:901228259924 at 192.168.19.6:5060
May  5 15:39:48 opensips /usr/sbin/opensips[6303]: incoming reply

II. For the direction from Asterisk to Opensips

1. Asterisk
- Add inbound route for the DID (11111111 as an example) in FreePBX web
interface
- Route call to this dial plan
[call_to_opensips]
exten => s,1,Dial(SIP/to-opensips/1001)
exten => s,n,Hangup

2. Opensips : Do nothing

3. Result :
- Dial to the DID -> Asteriks gets the message as i've  posted before.
    -- Executing [s at from-zaptel:13] Goto("Zap/2-1", "from-pstn|11111111|1")
in new stack
    -- Goto (from-pstn,11111111,1)
    -- Executing [11111111 at from-pstn:1] Set("Zap/2-1",
"__FROM_DID=11111111") in new stack
    -- Executing [11111111 at from-pstn:2] Gosub("Zap/2-1",
"app-blacklist-check|s|1") in new stack
    -- Executing [s at app-blacklist-check:1] LookupBlacklist("Zap/2-1", "") in
new stack
    -- Executing [s at app-blacklist-check:2] GotoIf("Zap/2-1",
"0?blacklisted") in new stack
    -- Executing [s at app-blacklist-check:3] Set("Zap/2-1",
"CALLED_BLACKLIST=1") in new stack
    -- Executing [s at app-blacklist-check:4] Return("Zap/2-1", "") in new
stack
    -- Executing [11111111 at from-pstn:3] ExecIf("Zap/2-1", "1
|Set|CALLERID(name)=462787800") in new stack
    -- Zap/1-1 is ringing
    -- Executing [11111111 at from-pstn:4] Set("Zap/2-1",
"__CALLINGPRES_SV=allowed_not_screened") in new stack
    -- Executing [11111111 at from-pstn:5] SetCallerPres("Zap/2-1",
"allowed_not_screened") in new stack
    -- Executing [11111111 at from-pstn:6] Goto("Zap/2-1",
"call_to_opensips|s|1") in new stack
    -- Goto (call_to_opensips,s,1)
    -- Executing [s at call_to_opensips:1] Dial("Zap/2-1",
"SIP/to-opensips/1001") in new stack
  *  -- Called to-opensips/1001*
    -- SIP/to-opensips-00000762 is circuit-busy
  == Everyone is busy/congested at this time (1:0/1/0)
    -- Executing [s at call_to_opensips:2] Hangup("Zap/2-1", "") in new stack
  == Spawn extension (call_to_opensips, s, 2) exited non-zero on 'Zap/2-1'
    -- Hungup 'Zap/2-1'
    -- Channel 0/1, span 1 got hangup request, cause 21
    -- Zap/1-1 is circuit-busy
    -- Hungup 'Zap/1-1'
  == Everyone is busy/congested at this time (1:0/1/0)
    -- Executing [s at macro-dialout-trunk:20] NoOp("SIP/1002-00000761", "Dial
failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 21")
in new stack
    -- Executing [s at macro-dialout-trunk:21] Goto("SIP/1002-00000761",
"s-CONGESTION|1") in new stack
    -- Goto (macro-dialout-trunk,s-CONGESTION,1)
    -- Executing [s-CONGESTION at macro-dialout-trunk:1]
Set("SIP/1002-00000761", "RC=21") in new stack
    -- Executing [s-CONGESTION at macro-dialout-trunk:2]
Goto("SIP/1002-00000761", "21|1") in new stack
    -- Goto (macro-dialout-trunk,21,1)
    -- Executing [21 at macro-dialout-trunk:1] Goto("SIP/1002-00000761",
"continue|1") in new stack

- Opensips: Nothing happend
May  5 18:20:31 opensips /usr/sbin/opensips[9290]: new branch at
sip:1001 at 10.2.14.122:5060
May  5 18:20:31 opensips /usr/sbin/opensips[9296]: incoming reply
May  5 18:20:31 opensips /usr/sbin/opensips[9295]: incoming reply
(debug level = 3)

- [root at opensips log]# opensipsctl online
database engine 'MYSQL' loaded
Control engine 'FIFO' loaded
1001


*Additionally, i have another error with local calls : Proxy authentication
required *
*(1001 calls 1002) although both of them are registered !!!!*
*
*
*
*
Please help me to find out why!

Date: Fri, 6 May 2011 14:06:38 +1000
From: Mark Sayer <datapipes at avtb.co.nz>
Subject: Re: [OpenSIPS-Users] Call from Asterisk to Opensips
To: OpenSIPS users mailling list <users at lists.opensips.org>
Message-ID: <BANLkTikSihpQwSPQ1gVQM4b2522z6oHePg at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

You have provided us with the error message from Asterisk but what
have you looked to see what OpenSIPS is doing? Is ext1001 currently
registered with OpenSIPS? There are a number of ways that Asterisk and
OpenSIPS might be configured to operate together. You will have to
give us more information on your setup.

Mark

On Fri, May 6, 2011 at 1:53 PM, Duong Manh Truong
<ngoahotanglongbk at gmail.com> wrote:
> Hi all,
> I've created sip trunk on Asterisk and defined asterisk server ip on
address
> table of opensips
> Then, from extension of Opensips , i can dial out to pstn through Asterisk
> Now, i want to route PSTN call to the extension
> but when Asterisk receive the call from PSTN and dial Opensips through the
> Sip Trunk
> i always got the message in the asterisk's console:
> ?Called to-opensips/1001
> ? ? -- SIP/to-opensips-00000745 is circuit-busy
> ? == Everyone is busy/congested at this time (1:0/1/0)
> (1001 is the extension of Opensips)
> Then the call hangs up.
> Anyone got this problem ? please help me the way to deal with!
> Thanks so much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110508/6329d9fb/attachment-0001.htm>


More information about the Users mailing list