A
A
Anton Ulanov2018-07-24 17:00:59
Asterisk
Anton Ulanov, 2018-07-24 17:00:59

How to return CallerID to service?

Good day, I'm trying to record incoming calls in the call queue. Logically, an incoming call comes from the trunk to the PBX, then it gets into the queue where it is already and rushes to the person who answered the phone. According to the logs, there is an incoming number, but it does not fall into the recording macro.
LOG:

Connected to Asterisk 15.4.1 currently running on ats (pid = 5205)
  == Using SIP RTP CoS mark 5
       > 0x7ffa54012540 -- Strict RTP learning after remote address set to: [ip внешней АТС]:16322
    -- Executing [транк]@call-in:1] Queue("SIP/[транк]-00000000", "test,r,,tTM(crm^[Здесь виден номер входящего звонка]^[транк])") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/101
  == Using SIP RTP CoS mark 5
    -- Called SIP/102
    -- SIP/102-00000002 is ringing
       > 0x7ffa6004bad0 -- Strict RTP learning after remote address set to: 192.168.1.8:7078
    -- SIP/102-00000002 answered SIP/[транк]-00000000
    -- Executing [[email protected]:1] NoOp("SIP/102-00000002", " ") in new stack
    -- Executing [[email protected]:2] GotoIf("SIP/102-00000002", "0?gtme") in new stack
    -- Executing [[email protected]:3] GotoIf("SIP/102-00000002", "0?gtme") in new stack
    -- Executing [[email protected]:4] Set("SIP/102-00000002", "F=/var/spool/asterisk/calls/201807/20180724/20180724134938--") in new stack
    -- Executing [[email protected]:5] MixMonitor("SIP/102-00000002", "/var/spool/asterisk/calls/201807/20180724/20180724134938--.wav,W(1),lame -b 16 /var/spool/asterisk/calls/201807/20180724/20180724134938--.wav /var/spool/asterisk/calls/201807/20180724/20180724134938--.mp3 && rm /var/spool/asterisk/calls/201807/20180724/20180724134938--.wav") in new stack
    -- Executing [[email protected]:6] MacroExit("SIP/102-00000002", "") in new stack
  == Begin MixMonitor Recording SIP/102-00000002
    -- Channel SIP/102-00000002 joined 'simple_bridge' basic-bridge <e2e0ac05-bd7a-4da4-a218-c03deda39db1>
    -- Channel SIP/[транк]-00000000 joined 'simple_bridge' basic-bridge <e2e0ac05-bd7a-4da4-a218-c03deda39db1>
       > 0x7ffa6004bad0 -- Strict RTP switching to RTP target address 192.168.1.8:7078 as source
       > 0x7ffa54012540 -- Strict RTP switching to RTP target address [ip внешней АТС]:16322 as source
       > 0x7ffa54012540 -- Strict RTP learning complete - Locking on source address [ip внешней АТС]:16322
       > 0x7ffa6004bad0 -- Strict RTP learning complete - Locking on source address 192.168.1.8:7078
    -- Channel SIP/102-00000002 left 'simple_bridge' basic-bridge <e2e0ac05-bd7a-4da4-a218-c03deda39db1>
    -- Channel SIP/[транк]-00000000 left 'simple_bridge' basic-bridge <e2e0ac05-bd7a-4da4-a218-c03deda39db1>
  == MixMonitor close filestream (mixed)
  == Executing [lame -b 16 /var/spool/asterisk/calls/201807/20180724/20180724134938--.wav /var/spool/asterisk/calls/201807/20180724/20180724134938--.mp3 && rm /var/spool/asterisk/calls/201807/20180724/20180724134938--.wav]
  == Spawn extension (call-in, [транк], 1) exited non-zero on 'SIP/[транк]-00000000'
  == End MixMonitor Recording SIP/102-00000002
[Jul 24 13:50:04] WARNING[5275]: chan_sip.c:4072 retrans_pkt: Retransmission timeout reached on transmission [email protected]:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response

config extensions.conf
[general]
static=yes
writeprotect=no
[globals]
RECORDING=1
DIR_RECORDS=/var/spool/asterisk/calls/
[default]


;Вешаем трубку
[handup-sip]
exten => _X!,1,HangUp()

;Исходящие звонки
[call-out]
;Звонок на внутренний номер
include => handup-sip
include => outcalling

[outcalling]
;exten => _XXX,1,Set(fname=${STRFTIME(${EPOCH},,%Y%m%d%H%M)}-${CALLERID(number)}-${EXTEN})
;exten => _XXX,2,MixMonitor(/var/spool/asterisk/calls/${fname}.wav)
exten => _XXX,1,Dial(SIP/${EXTEN},,tTM(crm^${CALLERID(num)}^${EXTEN}))
exten => _XXX.,1,Dial(SIP/${EXTEN}@[транк]
switch => Realtime/[email protected]

[call-in]
exten => [транк],1,Queue(test,r,,tTM(crm^${CALLERID(num)}^${EXTEN}))

[macro-crm]
exten => s,1,NoOp(${ARG1} ${ARG2})
exten => s,n,GotoIf(${DB_EXISTS(NORECNUM/${ARG1})}?gtme)
exten => s,n,GotoIf(${DB_EXISTS(NORECNUM/${ARG2})}?gtme)
exten => s,n,Set(F=/var/spool/asterisk/calls/${STRFTIME(${EPOCH},,%Y%m)}/${STRFTIME(${EPOCH},,%Y%m%d)}/${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}-${ARG1}-${ARG2})
exten => s,n,MixMonitor(${F}.wav,W(1),lame -b 16 ${F}.wav ${F}.mp3 && rm ${F}.wav)
exten => s,n(gtme),MacroExit

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
V
Viktor, 2018-07-25
@awsswa59

exten => _XXX,1,Dial(SIP/${EXTEN},,tTU(crm^s^1))

[crm]
exten => s,1,NoOp(=${CALLERID(num)}=${EXTEN}=)
exten => s,n,GotoIf(${DB_EXISTS(NORECNUM/${CALLERID(num)})}?gtme)
exten => s,n,GotoIf(${DB_EXISTS(NORECNUM/${EXTEN})}?gtme)
exten => s,n,Set(F=/var/spool/asterisk/calls/${STRFTIME(${EPOCH},,%Y%m)}/${STRFTIME(${EPOCH},,%Y%m%d)}/${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}-${ARG1}-${ARG2})
exten => s,n,MixMonitor(${F}.wav,W(1),lame -b 16 ${F}.wav ${F}.mp3 && rm ${F}.wav)
exten => s,n(gtme),Return

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question