Re: [asterisk-users] 400 reply to INVITE not properly treated

2018-08-02 Thread Daniel Tryba
On Thu, Aug 02, 2018 at 02:40:48PM +1000, Patrick Wakano wrote:
> In my opinion, Asterisk should at fail the Dial and proceed with whatever
> was configured in the dialplan I tried some other 4XX SIP codes, but
> the only one I found not behaving properly is the 400 one

I think you are right, any 4xx is a final response. The call has failed at
this moment (unless there are other branches). You should file a bug report
IMHO.

https://tools.ietf.org/html/rfc3261#section-13.2.2.3
   A single non-2xx final response may be received for the INVITE.  4xx,
   5xx and 6xx responses may contain a Contact header field value
   indicating the location where additional information about the error
   can be found.  Subsequent final responses (which would only arrive
   under error conditions) MUST be ignored.

   All early dialogs are considered terminated upon reception of the
   non-2xx final response.

   After having received the non-2xx final response the UAC core
   considers the INVITE transaction completed.  The INVITE client
   transaction handles the generation of ACKs for the response (see
   Section 17).


signature.asc
Description: PGP signature
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] PJSIP redirect_method=uri_core and header modifications

2018-08-02 Thread Daniel Tryba
On Thu, Aug 02, 2018 at 05:29:23PM +0200, Daniel Tryba wrote:
> With chan_sip there is the variable SIP_MAX_FORWARDS to set
> Max-Forwards. This counter is persistant after a redirect. I can't find
> the equivalent for PJSIP, so I went the way of header manipulation. Only
> to find out that any headers added to the outbound leg are lost after a
> redirect (with redirect_method=uri_core (didn't try any other since in
> the past they didn't work for me)).
> 
> Am I missing something? Or is this a PJSIP feature?

Forgot to mention this is tested on Debian/stable its Asterisk:
13.14.1~dfsg-2+deb9u3 (so 13.14.x with some fixes).


signature.asc
Description: PGP signature
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] PJSIP redirect_method=uri_core and header modifications

2018-08-02 Thread Daniel Tryba
With chan_sip there is the variable SIP_MAX_FORWARDS to set
Max-Forwards. This counter is persistant after a redirect. I can't find
the equivalent for PJSIP, so I went the way of header manipulation. Only
to find out that any headers added to the outbound leg are lost after a
redirect (with redirect_method=uri_core (didn't try any other since in
the past they didn't work for me)).

Am I missing something? Or is this a PJSIP feature?

chan_sip example:

[macro-maxforwards]
exten => s,1,NoOp()
exten => s,n,Set(mf=${SIP_HEADER(Max-Forwards)})
exten => s,n,Set(mf=$[ ${mf} - 1 ])
exten => s,n,ExecIf($[ ${mf} < 1 ]?Hangup(19))
exten => s,n,Set(__SIP_MAX_FORWARDS=${mf})
exten => s,n,SipAddHeader(X-Foo: bar)
exten => s,n,MacroExit()

[route]
...
exten => _+.,n,Macro(maxforwards)
exten => _+.,n,Dial(SIP/${EXTEN}@redirector)

An incomig INVITE will look like:

> INVITE sip:+number@asterisk;user=phone SIP/2.0
> Max-Forwards: 70

To the redirector:

> INVITE sip:+number@asterisk;user=phone SIP/2.0
> Max-Forwards: 69
> X-Foo: bar

< SIP/2.0 302 Redirect
< Contact: 

To somewhereelse:

> INVITE sip:+number@somewhereelse;user=phone SIP/2.0
> Max-Forwards: 69
> X-Foo: bar


PJSIP example (where the add strangely overrides the default
Max-Forwards: 70).

[setoutgoinglegvars]
exten => add,1,Set(PJSIP_HEADER(add,Max-Forwards)=60)
exten => add,1,Set(PJSIP_HEADER(add,X-Foo)=bar)
exten => add,n,Return()

[route]
...
exten => _+.,n,Macro(maxforwards)
exten => _+.,n,Dial(PJSIP/${EXTEN}@redirector,,b(setoutgoinglegvars,add,1))

> INVITE sip:+number@asterisk;user=phone SIP/2.0
> Max-Forwards: 70

To the redirector:

> INVITE sip:+number@asterisk;user=phone SIP/2.0
> Max-Forwards: 60
> X-Foo: bar

< SIP/2.0 302 Redirect
< Contact: 

To somewhereelse:

> INVITE sip:+number@somewhereelse;user=phone SIP/2.0
> Max-Forwards: 70



signature.asc
Description: PGP signature
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Asterisk 13.22.0 - No channel type registered for 'Agent' when queue rings - solved

2018-08-02 Thread Stefan Viljoen
Hi Guys

Found the solution for this...!

https://wiki.asterisk.org/wiki/display/AST/New+in+12#Newin12-channels_chan_a
gent

and

https://reviewboard.asterisk.org/r/2657/diff/1/

and

https://blogs.asterisk.org/2016/02/10/converting-from-chan_agent-to-app_agen
t_pool/

clarifies the situation. After Asterisk 12, chan_agent  was removed from
Asterisk.

It has been replaced with the AgentRequest application.

So I had to adapt my previously posted configs as follows to get queued
agents working and answering incoming calls to the queue.

My agents.conf stayed unchanged from my original post.

My queues.conf had to change from my original post to:

---
member=> Local/3997@internal,,3997,Agent:3997
member=> Local/3998@internal,,3998,Agent:3998
---

with the rest of the queue settings remaining the same.

The agent login extension had to change to:

---
exten=>1007,1,NoOp(Login agent from ${CALLERID(num)})
 same=>n,Set(MONITOR_OPTIONS=b)
 same=>n,UnpauseQueueMember(,Local/${CALLERID(num)}@internal)
 same=>n,AgentLogin(${CALLERID(num)},s)
---

In my [internal] context (where my phones live - including my test phones
3997 and 3998) I had to add extensions that would call the AgentRequest()
dialplan application on each of them if that extension was dialled. This is
effectively how the queue is answered:

---
[internal]
.
.
.
exten=>3997,1,AgentRequest(3997)
 same=>n,Hangup()

exten=>3998,1,AgentRequest(3998)
 same=>n,Hangup()
.
.
.
---

Then I set up a testing extension in [internal] called '48' that would
trigger the queue and let me test:

[internal]
.
.
.
exten=>48,1,NoOp(Sending test call to testq)
same=>n,Queue(testq,trhc)
.
.
.
---

So, my test procedure was:

1. Phone 1007 on phone 3997 (1007 - see my original post - is my agent login
extension that calls AgentLogin on the dialing extension.) This logs me into
the queue 'testq' as Agent 3997.

2. Phone 1007 on phone 3998. This logs me into the queue 'testq' as Agent
3998.

3. Phone 48 from any other phone, which calls the Queue application on the
testq, which is defined in queues.conf as consisting of agents / phones 3997
and 3998.

4. Due to my queue being set to " strategy = leastrecent" on repeated calls
to extension 48, either 3997 or 3998 would pick up calls made.

This is exactly the functionality desired and I now have a working model of
Agent queues in Asterisk 13 using the new (to me) app_agent_pool interface
via AgentRequest instead of trying to use "chan_agent" which no longer
exists post Asterisk 12.

All that is now needed is to GOTO from my incoming extension to local,48,1
or simply do Queue(testq,trhc) from my incoming extension directly. If I
have logged in agents in the testq queue, the most least recently dialled
agent will get connected to the caller.

Maybe this helps someone.

Kind regards,

Stefan


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Struggling to make sense of sending DTMF and why DIAL is trying to make multiple calls?

2018-08-02 Thread Jonathan H
Hi there; I'm trying to dial into a Zoom conference, send some digits,
wait, send a name, and be "in the room", as it were.

I thought this would work:

same => 
n,Dial(PJSIP/02036950088@voipfone-205,12,r(callWaiting)D(WWW12345W#WW::))

But it didn't, so I tried all of these:

same => 
n,Dial(PJSIP/02036950088@voipfone-205,12,r(callWaiting)D(:WWW12345W#WW:))
same => 
n,Dial(PJSIP/02036950088@voipfone-205,12,r(callWaiting)D(::WWW12345W#WW))
same => 
n,Dial(PJSIP/02036950088@voipfone-205,12,r(callWaiting)D(WWW12345W#WW:WWW12345W#WW:WWW12345W#WW))

Still nothing. So I thought send_DTMF might work.

Of course, this is too simple, and doesn't work:

[dial-zoom-bcab]
exten => s,1,Verbose(1,Dialling BCAB Zoom)
same => 
n,Dial(PJSIP/02036950088@voipfone-205,,U(dial-zoom-bcab^called_channel^1)))
same => n,Wait(3)
same => n,SendDTMF(1234#WWW#WW)
same => n,Playback(technical-support)
same => n,SendDTMF(#)
;same => n,Wait(15)
same => n,Hangup()

So I found an example of how to dial, and then send DTMF at
https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_Dial

[dial-zoom-bcab]
exten => s,1,Verbose(1,Dialling BCAB Zoom)
same => 
n,Dial(PJSIP/02036950088@voipfone-205,,U(dial-zoom-bcab^called_channel^1)))
same => n,Playback(abandon-all-hope)
same => n,Hangup()

exten => called_channel,1,Answer()
same => n,Wait(3)
same => n,SendDTMF(1234#WWW#WWW)
same => n,Playback(technical-support)
same => n,SendDTMF(#)
;same => n,Wait(8)
same => n,Return()

Not only did that not work, but I rapidly got an email alerting me to
having run out of ITSP credit (fortunately I only keep £2 or so and
the calls are only 1.2p each).

What I hadn't noticed on the log was that asterisk was making multiple
simultaneous calls, and even after I had hung up!

Here's my ITSP log for the latest batch. The only way to stop the
calls was to restart Asterisk. I'm confused (and concerned) as hell as
to how this happened with that example code above?

Time, ext, number, duration.
12:25 205 02036950088 0:14 0.0120 0
12:25 205 02036950088 0:16 0.0120 0
12:25 205 02036950088 0:18 0.0120 0
12:25 205 02036950088 0:20 0.0120 0
12:25 205 02036950088 0:21 0.0120 0
12:25 205 02036950088 0:23 0.0120 0
12:25 205 02036950088 0:25 0.0120 0
12:25 205 02036950088 0:27 0.0120 0
12:25 205 02036950088 0:29 0.0120 0
12:25 205 02036950088 0:31 0.0120 0
12:25 205 02036950088 0:33 0.0120 0
12:25 205 02036950088 0:35 0.0120 0
12:24 205 02036950088 0:37 0.0120 0
12:24 205 02036950088 0:39 0.0120 0
12:24 205 02036950088 0:40 0.0120 0
12:24 205 02036950088 0:42 0.0120 0
12:24 205 02036950088 0:44 0.0120 0
12:24 205 02036950088 0:46 0.0120 0
12:24 205 02036950088 0:48 0.0120 0

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Asterisk 13.22.0 - No channel type registered for 'Agent' when queue rings

2018-08-02 Thread Joshua Colp
On Thu, Aug 2, 2018, at 5:54 AM, Stefan Viljoen wrote:
> Hi All
> 
> With the below config, I just keep gettings this in the Asterisk 13.22.0
> CLI:
> 
> WARNING[15872][C-0051]: channel.c:6343 ast_request: No channel type
> registered for 'Agent'

chan_agent doesn't exist anymore[1] in Asterisk 13 and above.

[1] 
https://blogs.asterisk.org/2016/02/10/converting-from-chan_agent-to-app_agent_pool/

-- 
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Asterisk 13.22.0 - No channel type registered for 'Agent' when queue rings

2018-08-02 Thread Stefan Viljoen
Hi All

With the below config, I just keep gettings this in the Asterisk 13.22.0
CLI:

WARNING[15872][C-0051]: channel.c:6343 ast_request: No channel type
registered for 'Agent'

whenever a caller gets sent to that agent queue with logged in agents
waiting for calls on Asterisk 13.

3997 and 3998 are my two agents. They can call each other and receive calls
from other extensions. They can phone out of my PBX, no problems.

My agents.conf:

---
[agents](!)
autologoff=15
wrapuptime=5000
custom_beep=beep

[3997](agents)
fullname=>AGENT 1

[3998](agents)
fullname=>AGENT 2
---

My queues.conf:

---
[testq]
musicclass = default
strategy = leastrecent
timeout = 10
retry = 5
autofill = yes

member => Agent/3997,0,3997,hint:3997@default,no
member => Agent/3998,0,3998,hint:3998@default,no
---

Also, setting ringinuse on (change member line above to have "yes" at the
end) has no effect except to make the error "No channel type..." appear
twice in the 13.22.0 CLI per external ring heard by caller, instead of once
per external ring if ringinuse is set to "no" in the two lines above.

Logging in an agent in extensions.conf:

---
exten=>1007,1,NoOp(Login agent from ${CALLERID(num)})
 same=>n,Set(MONITOR_OPTIONS=b)
 same=>n,UnpauseQueueMember(,Agent/${CALLERID(num)})
 same=>n,AgentLogin(${CALLERID(num)},s)
---

Queue show with agents logged in:

---
localhost*CLI> queue show
testq has 0 calls (max unlimited) in 'leastrecent' strategy (0s holdtime, 0s
talktime), W:0, C:0, A:16, SL:0.0% within 0s
   Members:
  3997 (Agent/3997 from hint:3997@default) (ringinuse disabled) (In use)
has taken no calls yet
  3998 (Agent/3998 from hint:3998@default) (ringinuse disabled) (In use)
has taken no calls yet
   No Callers
---

Then, if the queue is called from outside:

---
localhost*CLI> queue show
testq has 1 calls (max unlimited) in 'leastrecent' strategy (0s holdtime, 0s
talktime), W:0, C:0, A:16, SL:0.0% within 0s
   Members:
  3997 (Agent/3997 from hint:3997@default) (ringinuse disabled) (In use)
has taken no calls yet
  3998 (Agent/3998 from hint:3998@default) (ringinuse disabled) (In use)
has taken no calls yet
   Callers:
  1. SIP/3916-0055 (wait: 0:08, prio: 0)
---

3916 is never answered, and neither 3997 or 3998 receive the call, both
continuing with MOH indefinitely.

Constantly on the CLI this comes up, timed with each ring of 3916 (the
"outside" phone):

---
localhost*CLI> queue show
testq has 1 calls (max unlimited) in 'leastrecent' strategy (0s holdtime, 0s
talktime), W:0, C:0, A:16, SL:0.0% within 0s
   Members:
  3997 (Agent/3997 from hint:3997@default) (ringinuse disabled) (In use)
has taken no calls yet
  3998 (Agent/3998 from hint:3998@default) (ringinuse disabled) (In use)
has taken no calls yet
   Callers:
  1. SIP/3916-0055 (wait: 0:08, prio: 0)
  
localhost*CLI>
[Aug  2 10:37:39] WARNING[16925][C-0056]: channel.c:6343 ast_request: No
channel type registered for 'Agent'
[Aug  2 10:37:44] WARNING[16925][C-0056]: channel.c:6343 ast_request: No
channel type registered for 'Agent'
[Aug  2 10:37:49] WARNING[16925][C-0056]: channel.c:6343 ast_request: No
channel type registered for 'Agent'


What am I doing wrong?

The expectation is that either 3997 or 3998 will receive the incoming call
placed by SIP/3916. As of now, 3916 rings forever, and 3997 and 3998 just
play MOH forever, with the above error emitted with each ring heard on 3916
which is calling into the queue looking for someone to pick up.

Thanks!


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users