Problem redirect Incoming call

I create a PBX using Asterisk and configured two queues. I have two numbers and I´d like do redirect everyone to each queue group.

Is there any variable that shows me de called number?

Before call goes to the queue use the ${EXTEN} variable to extract the value

I set ${EXTEN} at a NoOp to print the return

– Executing [s@Receptivo_BV:1] Answer(“SIP/5511113695423-00000000”, “”) in new stack
– Executing [s@Receptivo_BV:2] NoOp(“SIP/5511113695423-00000000”, “######CONSULTA NUMERO 1123741554 ENTRADA######”) in new stack
– Executing [s@Receptivo_BV:3] NoOp(“SIP/5511113695423-00000000”, “######CONSULTA s ENTRADA######”) in new stack
– Executing [s@Receptivo_BV:4] Queue(“SIP/5511113695423-00000000”, “FilaAdm,30,tT”) in new stack

Only appear ‘s’.

[Test]
exten =>s,1,Answer
exten =>s,2,NoOp(######CONSULTA NUMERO ${CALLERID(num)} ENTRADA######)
exten =>s,3,NoOp(######CONSULTA ${EXTEN} ENTRADA######)
same=>n,Queue(FilaAdm,30,tT)

Could you give a line example?

I´m a begginer.

Regards.

The called number is not being passed to you.

Please obtain a sip debug trace of the incoming INVITE and highlight every place where you believe the “called number” appears, and we may be able to suggest ways of extracting it.

If the called number appear on the sip trace would be posible that you will need to use the SIP_HEADER() function

In this case, I received the numer in To header/; 4520

SIP/2.0 200 OK
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5060;branch=z9hG4bK-fa1a5fdc37c111e6b1bd14feb5d9d54d;sig=6f2ed51d;received=177.53.16.41;rport=5060
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5060;rport;branch=z9hG4bK-fa1a5c3a37c111e6b1bd14feb5d9d54d;sig=7ac0f33f
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5062;rport=5062;branch=z9hG4bK-fa1a415a37c111e6b1bd14feb5d9d54d
Record-Route: sip:AQEAEB4qX01OAPF9HXNgKHT4WH8DAAQOEVy3AgAK8gHzsQiqs/Sp6A==@xxx.xxx.xxx.xxx;lr
Record-Route: sip:AQEAELU5JugY0zeiFO14niB/lLMDAARETuMW@xxx.xxx.xxx.xxx;lr
From: sip:1129791808@xxx.xxx.xxx.xxx:5062;user=phone;tag=VBymduGxNRApE8bhsTUQKRPEJ+NlHgAq
To: sip:4520@192.168.2.9;user=phone;tag=as53deea76
Call-ID: fa19c68a37c111e6b1bd14feb5d9d54d@xxx.xxx.xxx.xxx
CSeq: 1 INVITE
Server: Asterisk PBX 11.22.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: sip:s@192.168.2.9:5060

Take a look. Tks
In this case, I received the numer in To header/; 4520

SIP/2.0 200 OK
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5060;branch=z9hG4bK-fa1a5fdc37c111e6b1bd14feb5d9d54d;sig=6f2ed51d;received=177.53.16.41;rport=5060
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5060;rport;branch=z9hG4bK-fa1a5c3a37c111e6b1bd14feb5d9d54d;sig=7ac0f33f
Via: SIP/2.0/UDP xxx.xxx.xxx.xxx:5062;rport=5062;branch=z9hG4bK-fa1a415a37c111e6b1bd14feb5d9d54d
Record-Route: sip:AQEAEB4qX01OAPF9HXNgKHT4WH8DAAQOEVy3AgAK8gHzsQiqs/Sp6A==@xxx.xxx.xxx.xxx;lr
Record-Route: sip:AQEAELU5JugY0zeiFO14niB/lLMDAARETuMW@xxx.xxx.xxx.xxx;lr
From: sip:1129791808@xxx.xxx.xxx.xxx:5062;user=phone;tag=VBymduGxNRApE8bhsTUQKRPEJ+NlHgAq
To: sip:4520@192.168.2.9;user=phone;tag=as53deea76
Call-ID: fa19c68a37c111e6b1bd14feb5d9d54d@xxx.xxx.xxx.xxx
CSeq: 1 INVITE
Server: Asterisk PBX 11.22.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: sip:s@192.168.2.9:5060

Please edit your posting to use unformatted text (the </> button).

If the information is only in the To header, you will need to extract it with the SIP_HEADER function and then parse out the information you need using the various string manipulation functions.

Hello David, How are you?

I made the context below and worked.

A last question. I can´t transfer to a internal exten when I receive a external call. Do you know how I can solve this issue?

Regards.

[Receptivo_BV]

exten =>s,1,NoOp( ###### SIP HEADER ${SIP_HEADER(TO)} MCDU ###### )

same => 2,Goto(10)
same => 3,Goto(20)
same => 3,Goto(30)

same => 10,Set(VOIP=${CUT(CUT(SIP_HEADER(TO),@,1),:,2)})
;sane => n,Set(VOIP_SUPORTE_MCDU=${CUT(${VOIP_SUPORTE},@,1)})
;same => n,Set(VOIP_SUPORTE_MCDU_1={${CUT(${VOIP_SUPORTE_MCDU},:,2)})
same => n,GotoIf($[${VOIP} = 4520]?20)
same => n,GotoIf($[${VOIP} = 4516]?30)

same => 20,Answer
same => n,NoOp( ###### ENTRADA SUPORTE ${VOIP} ###### )
same => n,Queue(FilaSuporte,60,tT)
same => n,Hangup

same => 30,Answer
same => _1XX,Dial(SIP/${EXTEN}@Ramais,60,tT)
same => n,Queue(FilaAdm,60,tT)
same => n,Hangup

I changed a little the code

Is the best practice?

The only issu is tranfer a extenal incoming call.

If I made a outgoping call and start a transfer, work well.

exten =>s,1,NoOp( ###### SIP HEADER ${SIP_HEADER(TO)} MCDU ###### )

same => 2,Goto(10)
same => 3,Goto(20)
same => 3,Goto(30)

same => 10,Set(VOIP=${CUT(CUT(SIP_HEADER(TO),@,1),:,2)})
same => n,GotoIf($[${VOIP} = 4520]?20)
same => n,GotoIf($[${VOIP} = 4516]?30)

same => 20,Answer
same => n,NoOp( ###### ENTRADA SUPORTE ${VOIP} ###### )
same => n,Queue(FilaSuporte,60,tTrW)
same => n,Hangup

same => 30,Answer
same => n,NoOp( ###### ENTRADA SUPORTE ${VOIP} ###### )
same => n,Queue(FilaAdm,60,tTrW)
same => n,Hangup

exten =>_1XX,1,Dial(SIP/${EXTEN},60,TtrW)