Aterisk New Channel Event Problem


#1

Hi all

We are Using The Asterisk® Open Source PBX asterisk 1.6.2.6 version we are also using konference(app_konference) 1.4 .
we are registering 3 extension on one linux based hardfone using pjsua 1.8 as the useragent…
the dial plan used for each hardfone is as follows.
as follows here is dial plan in extensions.conf

exten => 0011,1,Wait(0.05)
exten => 0011,2,Queue(0011)
exten => 0111,1,Dial(SIP/0111)
exten => 0211,1,Dial(SIP/0211)

exten => 0012,1,Wait(0.05)
exten => 0012,2,Queue(0012)
exten => 0112,1,Dial(SIP/0112)
exten => 0212,1,Dial(SIP/0212)

When i call from hardfone using pjsua from sip:0011 to sip:0012@192.168.0.1

the call is confirmed on pjsua for phone1’s sip:0011 sip entity but asterisk generates new channel event of SIP/0111 or 0211 randomly

To start with does this issue lie with Asterisk or the sip usragent on the hardfone…?
If the problem is with asterisk & or the dial plan is there a resoultion…?
Does this issue
thanks in advance


#2

for what i konw the queue command work with names configured in the file queues.conf like:
in extension.conf:
exten => 12345,1,queue(example)

in queues.conf you have a section

[example]
member => SIP/
;here you can include all your sip extension you can call or all together or roundrobin ecc ecc ecc

hope to give you some hint :bulb: :bulb: :bulb: to solve your problem


#3

hi all
hi lorenzo_s
Actually my problem is at caller’s side the when hardfone1 i.e. sip:0011 calls sip:0012. The caller’s new channel event is generated.
And that caller is added in queue [0012] which is handled by member SIP/0012 .
As call is placed from the sip:0011 I should get new channel event of SIP/0011 - XXXXXXX.
But I am getting new channel event of SIP/0111 or SIP/0211 i.e. callers sip identity is changed but that is fully transparent to pjsua as it gets call confirmed on sip:0011 only .

thanks in advance
Pranav Thipse


#4

hi all
following are my config files please check and reply if anything wrongly configured other settings not written are set tto default

sip.conf

[code][general]
context = default
allowoverlap = no
udpbindaddr = 0.0.0.0
tcpenable = no
tcpbindaddr = 0.0.0.0

srvlookup = yes

disallow = all
allow = g722
autoframing = yes

[0011]
username = 0011
secret = 0011
type = peer
host = dynamic
context = users
insecure = port,invite
[0111]
username = 0111
secret = 0111
type = peer
host = dynamic
context = users
insecure = port,invite
[0211]
username = 0211
secret = 0211
type = peer
host = dynamic
context = users
insecure = port,invite
[0012]
username = 0012
secret = 0012
type = peer
host = dynamic
context = users
insecure = port,invite
[0112]
username = 0112
secret = 0112
type = peer
host = dynamic
context = users
insecure = port,invite
[0212]
username = 0212
secret = 0212
type = peer
host = dynamic
context = users
insecure = port,invite[/code]

extensions.conf

[code][general]
static = yes
writeprotect = no
clearglobalvars = no
[globals]
CONSOLE = Console/dsp ; Console interface for demo

IAXINFO = guest ; IAXtel username/password
TRUNK = DAHDI/G2 ; Trunk interface

TRUNKMSD = 1 ; MSD digits to strip (usually 1 or 0)

[users]

[stations]

exten => 0011,1,Wait(0.05)
exten => 0011,2,Queue(0011)
exten => 0111,1,Dial(SIP/0111)
exten => 0211,1,Dial(SIP/0211)

exten => 0012,1,Wait(0.05)
exten => 0012,2,Queue(0012)
exten => 0112,1,Dial(SIP/0112)
exten => 0212,1,Dial(SIP/0212)

[users]
include => stations
[/code]

queues.conf

[code][general]
persistentmembers = yes
autofill = yes
monitor-type = MixMonitor
shared_lastcall = no

[0011]
[0012]

[/code]


#5

if you place a call calling 0011 extension you call the 0011 queue. inside this queue there is nothing. maybe you can instead of:

[0011]
[0012]

try with something under the [] like:

[0011] member => SIP/0011 [0012] member => SIP/0012

or whatever you want to do if you place a call on the exten 0011 or 0012.


#6

actually on asterisk cli when I fire command
queue show
I get following output


0011 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
   Members: 
      SIP/0011 (dynamic) (Not in use) has taken no calls yet
   No Callers

Audiocom*CLI> 
0012 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
   Members: > 
      SIP/0012 (dynamic) (Not in use) has taken no calls yet
   No Callers

I am communicating with asterisk using AMI(Asterisk Manager Interface ) using AsteriskJava following is the dump I get wen I call from 0012 to 0011 actually channel should get created for SIP/0012 but I get new channel event of SIP/0112 as follows

  == Using SIP RTP CoS mark 5
    -- Executing [0011@users:1] Wait("SIP/0112-00000002", "0.05") in new stack
    -- Executing [0011@users:2] Queue("SIP/0112-00000002", "0011") in new stack
    -- Started music on hold, class 'default', on SIP/0112-00000002
  == Using SIP RTP CoS mark 5
    -- SIP/0011-00000003 answered SIP/0112-00000002
    -- Stopped music on hold on SIP/0112-00000002
    -- Native bridging SIP/0112-00000002 and SIP/0011-0000000

Following is the Event dump I get Through AMI API

INFO ChannelManager:161 - Adding channel SIP/0112-00000004(1323753260.4)
org.asteriskjava.manager.event.NewChannelEvent[file='channel.c',func='__ast_channel_alloc_ap',
line='966',sequenceNumber='153',dateReceived='Tue Dec 13 10:44:20 IST 2011',privilege='call,all',
callerid='0012',sequencenumber='153',state='Down',channelstate='0',calleridname=null,timestamp=null,
uniqueid='1323753260.4',context='users',exten='0011',accountcode=null,server=null,calleridnum='0012',
channel='SIP/0112-00000004',channelstatedesc='Down',systemHashcode=1525314]

as you can see callerid in above event is " 0012" but channel created is channel='SIP/0112-00000004’
this is my problem

thanks in advance
Pranav Thipse


#7

hi all

Has no one got error like this before ?
Have I configured anything wrong ?
any hint or help is appreciated …

Thanks in advance
Pranav Thipse


#8

I find it very difficult to believe that new channel events are in error. On the other hand, I got completely confused about what you say is going wrong.

For a start, following best practice and ensuring the sip.conf section names do not match the extension numbers normally used to make outgoing calls to them may make it easier to see what is going on.

If you make a call through a queue, and don’t do anything that would cause a masquerade, you should get two new channel events. The first for the incoming call, with a channel name that is a concatenation of the sip.conf section name and an opaque number (actually the address of a data structure, in some versions). The second should use the sip.conf section name for the outgoing call.

If two callers share an IP address and are being matched as peers, Asterisk cannot distinguish between them and will use the first match.

If there is no sip.conf match, but allowguest is on, an IP address will be used. If a literal address is used for the outgoing channel, that will be used, rather than the sip.conf section name.


#9

Hi david55,
Thanks for your response…
when i say that a “wrong” channel is created when a call is established. I meant the following…
when a call is placed from the sip : 0011 to sip: 0012. I expect the channel to be created for the same sip id sip : 0011. Whereas in our case the channel is created for the sip id sip :0111 / sip:0211. During all this, on the caller end the call is confirmed on sip :0011(from where the call was initaited). This has serious implications on the our application handling the asterisk events via (AMI). As a consequence the call managment on our application goes for a toss…
But as you pointed out later in your response here
"If two callers share an IP address and are being matched as peers, Asterisk cannot distinguish between them and will use the first match." (and if I have understood correctly) that since all the sip : 0011 / sip : 0111 / sip : 0211 are registered from the same IP this behaviour is normal for the asterisk standpoint. Is this correct?
If this is so is there a workaround by modifying or creating a more robust dial plan to make our scheme to work…where the the new channels are conformed on that particular sip entity that initiated the session i.e
call initated from say for e.g
caller callee
sip : 0011 <----> sip : 0012
and not to
caller callee
sip :0111 <----> sip : 0012
The reason we are doing all of this is that we have dual stream audio being handled by 2 different sip entites on the caller/callee side…
Any suggestions?
Thanks & Regards
Pranav Thipse


#10

You can use a user rather than a peer match, but then you will have to do the equivalent of setting fromuser at the other end, which will mean you cannot use the From: header for caller ID, atlhough there may be other caller-ID options open.

With a peer match, Asterisk only has the IP address to go on, so cannot distinguish.


#11

hi david55

thanks for reply will check in that direction.
can configuring type=friend in sip.conf will help?

Thanks & Regards
Pranav Thipse


#12

Use type=user. The key thing is you must match on the user part of the From: URL, so that must actually be the case at the sending end.