record incoming calls from clicktodial PHP script

Discussion in 'General' started by carlosnuel, Feb 11, 2010.

  1. carlosnuel

    Joined:
    Aug 5, 2008
    Messages:
    15
    Likes Received:
    0
    I develop a script in PHP to generate calls with asterisk (click2dial), I have installed elastix 1.5.3 and have enabled always recording incoming and outgoing calls. When i generate call from the c2c the script not record, my configuration is:

    $oSocket = fsockopen($this->host, 5038) or die("error");

    if ($oSocket)
    {
    fputs($oSocket, "Action: login\r\n");
    fputs($oSocket, "Events: off\r\n");
    fputs($oSocket, "Username: c2c \r\n");
    fputs($oSocket, "Secret: c2c r\n\r\n");
    fputs($oSocket, "Action: originate\r\n");
    fputs($oSocket, "Channel: ".$strChannel."\r\n");
    fputs($oSocket, "WaitTime: 30 \r\n");
    fputs($oSocket, "CallerId: ".$strCallerId."\r\n");
    fputs($oSocket, "Exten: ".$strExten."\r\n");
    fputs($oSocket, "Context: from-internal \r\n");
    fputs($oSocket, "Priority: 1\r\n\r\n");
    fputs($oSocket, "Action: Logoff\r\n\r\n");
    fclose($oSocket);
    }

    I hope someone can help me.
     
  2. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    If that doesn´t works, what I would do is the edit the context, and place, lets say:
    record-c2dial
    and write at the end of /etc/asterisk/extensions_custom.conf the following context:
    Code:
    [record-c2dial]
    exten => _.,1,Answer
    exten => _.,n,Set(date=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)})
    exten => _.,n,MixMonitor(c2dial-${date}-${EXTEN}.gsm)
    exten => _.,n,Goto(from-internal,${EXTEN},1)
    
    and then from the shell, execute:
    asterisk -rx "module reload"
     
  3. carlosnuel

    Joined:
    Aug 5, 2008
    Messages:
    15
    Likes Received:
    0
    Thank you Jgutierrez,

    Edit the file you told me (extensions_custom.conf) but the calls continue without recording

    i don't where is my mistake
     
  4. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Paste the cli output when the call is done
     
  5. carlosnuel

    Joined:
    Aug 5, 2008
    Messages:
    15
    Likes Received:
    0
    Hi,
    send you an email yesterday cause, because I couldnt log on to the forum. I applying the changes into to the file /etc/asterisk/extensions_custom.conf and my elastix die.

    implement changes in extensions_custom.conf were:

    Code:
    
    include => record-c2dial
    
    [record-c2dial]
    exten => _.,1,Answer
    exten => _.,n,Set(date=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)})
    exten => _.,n,MixMonitor(c2dial-${date}-${EXTEN}.wav)
    exten => _.,n,Goto(from-internal,${EXTEN},1)
    
    
    its odd because the incoming and outgoing calls if recorded, but the clicktodial, no.

    attach my extensions_custom.conf.
     
  6. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    You shouldn't have added the include line, on my origial post, it did not said that the include line should be added. All the settings are correct. Just erase it, and execute the module reload command as stated previously.

    In order to get the CLI debug, just type on the shell:
    asterisk -r

    Also append the new changes that you have done to your php agi
     
  7. carlosnuel

    Joined:
    Aug 5, 2008
    Messages:
    15
    Likes Received:
    0
    Hi jgutierrez,
    my asterisk cli output is:

    Code:
    [root@voip ~]# asterisk -r
    Asterisk 1.4.26.3, Copyright (C) 1999 - 2008 Digium, Inc. and others.
    Created by Mark Spencer <markster@digium.com>
    Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for detail
    s.
    This is free software, with components licensed under the GNU General Public
    License version 2 and other licenses; you are welcome to redistribute it under
    certain conditions. Type 'core show license' for details.
    =========================================================================
    Connected to Asterisk 1.4.26.3 currently running on voip (pid = 3296)
    Verbosity is at least 3
      == Parsing '/etc/asterisk/manager.conf': Found
      == Parsing '/etc/asterisk/manager_additional.conf': Found
      == Parsing '/etc/asterisk/manager_custom.conf': Found
      == Parsing '/etc/asterisk/manager_additional.conf': Found
      == Parsing '/etc/asterisk/manager_custom.conf': Found
      == Manager 'c2c' logged on from 127.0.0.1
     Extension Changed 5001[ext-local] new state Ringing for Notify User 5001
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4013
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4010
     Extension Changed 5001[ext-local] new state Ringing for Notify User 2001
     Extension Changed 5001[ext-local] new state Ringing for Notify User 1002
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4012
     Extension Changed 5001[ext-local] new state Ringing for Notify User 7004
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4002
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4011
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4014
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4006
     Extension Changed 5001[ext-local] new state Ringing for Notify User 6001
     Extension Changed 5001[ext-local] new state Ringing for Notify User 3001
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4005
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4009
     Extension Changed 5001[ext-local] new state Ringing for Notify User 9000
     Extension Changed 5001[ext-local] new state Ringing for Notify User 7002
     Extension Changed 5001[ext-local] new state Ringing for Notify User 7003
     Extension Changed 5001[ext-local] new state Ringing for Notify User 5005
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4008
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4301
     Extension Changed 5001[ext-local] new state Ringing for Notify User 5006
     Extension Changed 5001[ext-local] new state Ringing for Notify User 4010 (queue
    d)
     Extension Changed 5001[ext-local] new state Ringing for Notify User 5005
     Extension Changed 5001[ext-local] new state InUse for Notify User 5001
     Extension Changed 5001[ext-local] new state InUse for Notify User 4013
      == Manager 'admin' logged off from 127.0.0.1
     Extension Changed 5001[ext-local] new state InUse for Notify User 4010
     Extension Changed 5001[ext-local] new state InUse for Notify User 2001
     Extension Changed 5001[ext-local] new state InUse for Notify User 1002
     Extension Changed 5001[ext-local] new state InUse for Notify User 4012
     Extension Changed 5001[ext-local] new state InUse for Notify User 7004
        -- Executing [95552723100@from-internal:1] Macro("SIP/5001-14874630", "user-
    callerid|SKIPTTL|") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 4002
     Extension Changed 5001[ext-local] new state InUse for Notify User 4011
     Extension Changed 5001[ext-local] new state InUse for Notify User 4014
        -- Executing [s@macro-user-callerid:1] Set("SIP/5001-14874630", "AMPUSER=555
    2723100") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 4006
     Extension Changed 5001[ext-local] new state InUse for Notify User 6001
        -- Executing [s@macro-user-callerid:2] GotoIf("SIP/5001-14874630", "0?repor"
    ) in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 3001
        -- Executing [s@macro-user-callerid:3] ExecIf("SIP/5001-14874630", "1|Set|RE
    ALCALLERIDNUM=5552723100") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 4005
     Extension Changed 5001[ext-local] new state InUse for Notify User 4009
        -- Executing [s@macro-user-callerid:4] Set("SIP/5001-14874630", "AMPUSER=")
    in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 9000
     Extension Changed 5001[ext-local] new state InUse for Notify User 7002
        -- Executing [s@macro-user-callerid:5] Set("SIP/5001-14874630", "AMPUSERCIDN
    AME=") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 7003
        -- Executing [s@macro-user-callerid:6] GotoIf("SIP/5001-14874630", "1?repor"
    ) in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 5005
        -- Goto (macro-user-callerid,s,10)
     Extension Changed 5001[ext-local] new state InUse for Notify User 4008
     Extension Changed 5001[ext-local] new state InUse for Notify User 4301
        -- Executing [s@macro-user-callerid:10] GotoIf("SIP/5001-14874630", "1?conti
    nue") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 5006
     Extension Changed 5001[ext-local] new state InUse for Notify User 4010 (queued)
     Extension Changed 5001[ext-local] new state InUse for Notify User 5005
        -- Goto (macro-user-callerid,s,19)
        -- Executing [s@macro-user-callerid:19] NoOp("SIP/5001-14874630", "Using Cal
    lerID "Víctor" <5552723100>") in new stack
        -- Executing [95552723100@from-internal:2] Set("SIP/5001-14874630", "_NODEST
    =") in new stack
        -- Executing [95552723100@from-internal:3] Macro("SIP/5001-14874630", "recor
    d-enable||OUT|") in new stack
        -- Executing [s@macro-record-enable:1] GotoIf("SIP/5001-14874630", "1?check"
    ) in new stack
        -- Goto (macro-record-enable,s,4)
        -- Executing [s@macro-record-enable:4] AGI("SIP/5001-14874630", "recordingch
    eck|20100308-131142|1268075500.9508") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
      recordingcheck|20100308-131142|1268075500.9508: No AMPUSER db entry for . Not
    recording
        -- AGI Script recordingcheck completed, returning 0
        -- Executing [s@macro-record-enable:5] MacroExit("SIP/5001-14874630", "") in
     new stack
        -- Executing [95552723100@from-internal:4] Macro("SIP/5001-14874630", "dialo
    ut-trunk|5|52723100||") in new stack
        -- Executing [s@macro-dialout-trunk:1] Set("SIP/5001-14874630", "DIAL_TRUNK=
    5") in new stack
        -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5001-14874630", "0?sub-p
    incheck|s|1") in new stack
        -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5001-14874630", "0?disabl
    etrunk|1") in new stack
        -- Executing [s@macro-dialout-trunk:4] Set("SIP/5001-14874630", "DIAL_NUMBER
    =52723100") in new stack
        -- Executing [s@macro-dialout-trunk:5] Set("SIP/5001-14874630", "DIAL_TRUNK_
    OPTIONS=tr") in new stack
        -- Executing [s@macro-dialout-trunk:6] Set("SIP/5001-14874630", "OUTBOUND_GR
    OUP=OUT_5") in new stack
        -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5001-14874630", "1?nomax"
    ) in new stack
        -- Goto (macro-dialout-trunk,s,9)
        -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5001-14874630", "0?skipou
    tcid") in new stack
        -- Executing [s@macro-dialout-trunk:10] Set("SIP/5001-14874630", "DIAL_TRUNK
    _OPTIONS=") in new stack
        -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5001-14874630", "outbound
    -callerid|5") in new stack
        -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5001-14874630", "0|Se
    tCallerPres|") in new stack
        -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5001-14874630", "0|Se
    t|REALCALLERIDNUM=5552723100") in new stack
        -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5001-14874630", "1?no
    rmcid") in new stack
        -- Goto (macro-outbound-callerid,s,6)
        -- Executing [s@macro-outbound-callerid:6] Set("SIP/5001-14874630", "USEROUT
    CID=") in new stack
        -- Executing [s@macro-outbound-callerid:7] Set("SIP/5001-14874630", "EMERGEN
    CYCID=") in new stack
        -- Executing [s@macro-outbound-callerid:8] Set("SIP/5001-14874630", "TRUNKOU
    TCID=") in new stack
        -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5001-14874630", "1?tr
    unkcid") in new stack
        -- Goto (macro-outbound-callerid,s,12)
        -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5001-14874630", "0|S
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5001-14874630", "0|S
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5001-14874630", "0|S
    etCallerPres|prohib_passed_screen") in new stack
        -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/5001-14874630", "0|AGI|f
    ixlocalprefix") in new stack
        -- Executing [s@macro-dialout-trunk:13] Set("SIP/5001-14874630", "OUTNUM=991
    52723100") in new stack
        -- Executing [s@macro-dialout-trunk:14] Set("SIP/5001-14874630", "custom=SIP
    /GXW4108-CH1") in new stack
        -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5001-14874630", "0|Set|D
    IAL_TRUNK_OPTIONS=M(setmusic^)") in new stack
        -- Executing [s@macro-dialout-trunk:16] Macro("SIP/5001-14874630", "dialout-
    trunk-predial-hook|") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/5001-1487
    4630", "") in new stack
        -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/5001-14874630", "0?bypas
    s|1") in new stack
        -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5001-14874630", "0?custo
    mtrunk") in new stack
        -- Executing [s@macro-dialout-trunk:19] Dial("SIP/5001-14874630", "SIP/GXW41
    08-CH1/99152723100|300|") in new stack
        -- Called GXW4108-CH1/99152723100
      == Spawn extension (macro-dialout-trunk, s, 19) exited non-zero on 'SIP/5001-1
    4874630' in macro 'dialout-trunk'
      == Spawn extension (from-internal, 95552723100, 4) exited non-zero on 'SIP/500
    1-14874630'
        -- Executing [h@macro-dialout-trunk:1] Macro("SIP/5001-14874630", "hangupcal
    l|") in new stack
        -- Executing [s@macro-hangupcall:1] GotoIf("SIP/5001-14874630", "1?skiprg")
    in new stack
        -- Goto (macro-hangupcall,s,4)
        -- Executing [s@macro-hangupcall:4] GotoIf("SIP/5001-14874630", "1?skipblkv"
    ) in new stack
        -- Goto (macro-hangupcall,s,7)
        -- Executing [s@macro-hangupcall:7] GotoIf("SIP/5001-14874630", "1?theend")
    in new stack
        -- Goto (macro-hangupcall,s,9)
        -- Executing [s@macro-hangupcall:9] Hangup("SIP/5001-14874630", "") in new s
    tack
      == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/5001-14874
    630' in macro 'hangupcall'
      == Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on 'SIP/5001-14
    874630'
     Extension Changed 5001[ext-local] new state Idle for Notify User 5001
     Extension Changed 5001[ext-local] new state Idle for Notify User 4013
     Extension Changed 5001[ext-local] new state Idle for Notify User 4010
     Extension Changed 5001[ext-local] new state Idle for Notify User 2001
     Extension Changed 5001[ext-local] new state Idle for Notify User 1002
     Extension Changed 5001[ext-local] new state Idle for Notify User 4012
     Extension Changed 5001[ext-local] new state Idle for Notify User 7004
     Extension Changed 5001[ext-local] new state Idle for Notify User 4002
     Extension Changed 5001[ext-local] new state Idle for Notify User 4011
     Extension Changed 5001[ext-local] new state Idle for Notify User 4014
     Extension Changed 5001[ext-local] new state Idle for Notify User 4006
     Extension Changed 5001[ext-local] new state Idle for Notify User 6001
     Extension Changed 5001[ext-local] new state Idle for Notify User 3001
     Extension Changed 5001[ext-local] new state Idle for Notify User 4005
     Extension Changed 5001[ext-local] new state Idle for Notify User 4009
     Extension Changed 5001[ext-local] new state Idle for Notify User 9000
     Extension Changed 5001[ext-local] new state Idle for Notify User 7002
     Extension Changed 5001[ext-local] new state Idle for Notify User 7003
     Extension Changed 5001[ext-local] new state Idle for Notify User 5005
     Extension Changed 5001[ext-local] new state Idle for Notify User 4008
     Extension Changed 5001[ext-local] new state Idle for Notify User 4301
     Extension Changed 5001[ext-local] new state Idle for Notify User 5006
     Extension Changed 5001[ext-local] new state Idle for Notify User 4010 (queued)
     Extension Changed 5001[ext-local] new state Idle for Notify User 5005
     
    I modify my manager.conf but the calls not are recording.


    [c2c]
    secret = c2c
    deny=0.0.0.0/0.0.0.0
    permit=127.0.0.1/255.255.255.0
    read = system,call,log,verbose,command,agent,user,originate
    write = system,call,log,verbose,command,agent,user,originate
     
  8. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    I would like to see the CLI output when you are doing the call through your php application, I can't see that it is going through the context that you have written, so there are two posible explanations:

    1. On your php application, you are not setting correctly the context, you should set it to go into record-c2dial.
    2. You have attached the CLI output for another call
     
  9. carlosnuel

    Joined:
    Aug 5, 2008
    Messages:
    15
    Likes Received:
    0
    I believe the context is correct, i have into my php script is:

    Code:
    $strExten = "55723100";
    $oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or die("Hubo problemas al conectarse... intenta nuevamente");
    	fputs($oSocket, "Action: login\r\n");
    	fputs($oSocket, "Events: off\r\n");
    	fputs($oSocket, "Username: c2c\r\n");
    	fputs($oSocket, "Secret: c2c \r\n\r\n");
    	fputs($oSocket, "Action: originate\r\n");
    	fputs($oSocket, "Channel: SIP/5001 \r\n");
    	fputs($oSocket, "WaitTime: 30 \r\n");
    	fputs($oSocket, "CallerId: $strCallerId\r\n");
    	fputs($oSocket, "Exten: 9$strExten\r\n");
    	fputs($oSocket, "Context: from-internal\r\n"); 
    	fputs($oSocket, "Priority: 1\r\n\r\n");
    	fputs($oSocket, "Action: Logoff\r\n\r\n");
    	sleep(3);
    	fclose($oSocket);
    
    The cli Output was i wrote you in the previous reply. Paste again the CLI Output (Use 5001 extension and i call the phone numer (55)5572-3100):

    Code:
      == Manager 'c2c' logged off from 127.0.0.1
     Extension Changed 5001[ext-local] new state InUse for Notify User 4006
        -- Executing [95552723100@from-internal:1] Macro("SIP/5001-148f9a10", "user
    callerid|SKIPTTL|") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 9000
     Extension Changed 5001[ext-local] new state InUse for Notify User 5005
     Extension Changed 5001[ext-local] new state InUse for Notify User 2001
        -- Executing [s@macro-user-callerid:1] Set("SIP/5001-148f9a10", "AMPUSER=55
    2723100") in new stack
     Extension Changed 5001[ext-local] new state InUse for Notify User 7003
     Extension Changed 5001[ext-local] new state InUse for Notify User 4301
     Extension Changed 5001[ext-local] new state InUse for Notify User 5006
     Extension Changed 5001[ext-local] new state InUse for Notify User 4010 (queued
     Extension Changed 5001[ext-local] new state InUse for Notify User 5005
        -- Executing [s@macro-user-callerid:2] GotoIf("SIP/5001-148f9a10", "0?repor
    ) in new stack
        -- Executing [s@macro-user-callerid:3] ExecIf("SIP/5001-148f9a10", "1|Set|R
    ALCALLERIDNUM=5552723100") in new stack
        -- Executing [s@macro-user-callerid:4] Set("SIP/5001-148f9a10", "AMPUSER=")
    in new stack
        -- Executing [s@macro-user-callerid:5] Set("SIP/5001-148f9a10", "AMPUSERCID
    AME=") in new stack
        -- Executing [s@macro-user-callerid:6] GotoIf("SIP/5001-148f9a10", "1?repor
    ) in new stack
        -- Goto (macro-user-callerid,s,10)
        -- Executing [s@macro-user-callerid:10] GotoIf("SIP/5001-148f9a10", "1?cont
    nue") in new stack
        -- Goto (macro-user-callerid,s,19)
        -- Executing [s@macro-user-callerid:19] NoOp("SIP/5001-148f9a10", "Using Ca
    lerID "carlos" <5552723100>") in new stack
        -- Executing [95552723100@from-internal:2] Set("SIP/5001-148f9a10", "_NODES
    =") in new stack
        -- Executing [95552723100@from-internal:3] Macro("SIP/5001-148f9a10", "reco
    d-enable||OUT|") in new stack
        -- Executing [s@macro-record-enable:1] GotoIf("SIP/5001-148f9a10", "1?check
    ) in new stack
        -- Goto (macro-record-enable,s,4)
        -- Executing [s@macro-record-enable:4] AGI("SIP/5001-148f9a10", "recordingc
    eck|20100309-104052|1268152850.10453") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
      recordingcheck|20100309-104052|1268152850.10453: No AMPUSER db entry for . No
     recording
        -- AGI Script recordingcheck completed, returning 0
        -- Executing [s@macro-record-enable:5] MacroExit("SIP/5001-148f9a10", "") i
     new stack
        -- Executing [95552723100@from-internal:4] Macro("SIP/5001-148f9a10", "dial
    ut-trunk|5|52723100||") in new stack
        -- Executing [s@macro-dialout-trunk:1] Set("SIP/5001-148f9a10", "DIAL_TRUNK
    5") in new stack
        -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5001-148f9a10", "0?sub-
    incheck|s|1") in new stack
        -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5001-148f9a10", "0?disab
    etrunk|1") in new stack
        -- Executing [s@macro-dialout-trunk:4] Set("SIP/5001-148f9a10", "DIAL_NUMBE
    =52723100") in new stack
        -- Executing [s@macro-dialout-trunk:5] Set("SIP/5001-148f9a10", "DIAL_TRUNK
    OPTIONS=tr") in new stack
        -- Executing [s@macro-dialout-trunk:6] Set("SIP/5001-148f9a10", "OUTBOUND_G
    OUP=OUT_5") in new stack
        -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5001-148f9a10", "1?nomax
    ) in new stack
        -- Goto (macro-dialout-trunk,s,9)
        -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5001-148f9a10", "0?skipo
    tcid") in new stack
        -- Executing [s@macro-dialout-trunk:10] Set("SIP/5001-148f9a10", "DIAL_TRUN
    _OPTIONS=TW") in new stack
        -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5001-148f9a10", "outboun
    -callerid|5") in new stack
        -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5001-148f9a10", "0|S
    tCallerPres|") in new stack
        -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5001-148f9a10", "0|S
    t|REALCALLERIDNUM=5552723100") in new stack
        -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5001-148f9a10", "1?n
    rmcid") in new stack
        -- Goto (macro-outbound-callerid,s,6)
        -- Executing [s@macro-outbound-callerid:6] Set("SIP/5001-148f9a10", "USEROU
    CID=") in new stack
        -- Executing [s@macro-outbound-callerid:7] Set("SIP/5001-148f9a10", "EMERGE
    CYCID=") in new stack
        -- Executing [s@macro-outbound-callerid:8] Set("SIP/5001-148f9a10", "TRUNKO
    TCID=") in new stack
        -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5001-148f9a10", "1?t
    unkcid") in new stack
        -- Goto (macro-outbound-callerid,s,12)
        -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5001-148f9a10", "0|
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5001-148f9a10", "0|
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5001-148f9a10", "0|
    etCallerPres|prohib_passed_screen") in new stack
        -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/5001-148f9a10", "0|AGI|
    ixlocalprefix") in new stack
        -- Executing [s@macro-dialout-trunk:13] Set("SIP/5001-148f9a10", "OUTNUM=99
    52723100") in new stack
        -- Executing [s@macro-dialout-trunk:14] Set("SIP/5001-148f9a10", "custom=SI
    /GXW4108-CH1") in new stack
        -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5001-148f9a10", "0|Set|
    IAL_TRUNK_OPTIONS=M(setmusic^)TW") in new stack
        -- Executing [s@macro-dialout-trunk:16] Macro("SIP/5001-148f9a10", "dialout
    trunk-predial-hook|") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/5001-148
    9a10", "") in new stack
        -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/5001-148f9a10", "0?bypa
    s|1") in new stack
        -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5001-148f9a10", "0?cust
    mtrunk") in new stack
        -- Executing [s@macro-dialout-trunk:19] Dial("SIP/5001-148f9a10", "SIP/GXW4
    08-CH1/99152723100|300|TW") in new stack
        -- Called GXW4108-CH1/99152723100
        -- Got SIP response 503 "Service Unavailable" back from 192.168.1.11
        -- SIP/GXW4108-CH1-14b2ac40 is circuit-busy
      == Everyone is busy/congested at this time (1:0/1/0)
        -- Executing [s@macro-dialout-trunk:20] Goto("SIP/5001-148f9a10", "s-CONGES
    ION|1") in new stack
        -- Goto (macro-dialout-trunk,s-CONGESTION,1)
        -- Executing [s-CONGESTION@macro-dialout-trunk:1] GotoIf("SIP/5001-148f9a10
    , "1?noreport") in new stack
        -- Goto (macro-dialout-trunk,s-CONGESTION,3)
        -- Executing [s-CONGESTION@macro-dialout-trunk:3] NoOp("SIP/5001-148f9a10",
    "TRUNK Dial failed due to CONGESTION - failing through to other trunks") in new
    stack
        -- Executing [95552723100@from-internal:5] Macro("SIP/5001-148f9a10", "dial
    ut-trunk|7|52723100||") in new stack
        -- Executing [s@macro-dialout-trunk:1] Set("SIP/5001-148f9a10", "DIAL_TRUNK
    7") in new stack
        -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5001-148f9a10", "0?sub-
    incheck|s|1") in new stack
        -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5001-148f9a10", "0?disab
    etrunk|1") in new stack
        -- Executing [s@macro-dialout-trunk:4] Set("SIP/5001-148f9a10", "DIAL_NUMBE
    =52723100") in new stack
        -- Executing [s@macro-dialout-trunk:5] Set("SIP/5001-148f9a10", "DIAL_TRUNK
    OPTIONS=tr") in new stack
        -- Executing [s@macro-dialout-trunk:6] Set("SIP/5001-148f9a10", "OUTBOUND_G
    OUP=OUT_7") in new stack
        -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5001-148f9a10", "1?nomax
     in new stack
        -- Goto (macro-dialout-trunk,s,9)
        -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5001-148f9a10", "0?skipo
    tcid") in new stack
        -- Executing [s@macro-dialout-trunk:10] Set("SIP/5001-148f9a10", "DIAL_TRUN
    _OPTIONS=TW") in new stack
        -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5001-148f9a10", "outboun
    -callerid|7") in new stack
        -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5001-148f9a10", "0|S
    tCallerPres|") in new stack
        -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5001-148f9a10", "0|S
    t|REALCALLERIDNUM=5552723100") in new stack
        -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5001-148f9a10", "1?n
    rmcid") in new stack
        -- Goto (macro-outbound-callerid,s,6)
        -- Executing [s@macro-outbound-callerid:6] Set("SIP/5001-148f9a10", "USEROU
    CID=") in new stack
        -- Executing [s@macro-outbound-callerid:7] Set("SIP/5001-148f9a10", "EMERGE
    CYCID=") in new stack
        -- Executing [s@macro-outbound-callerid:8] Set("SIP/5001-148f9a10", "TRUNKO
    TCID=") in new stack
        -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5001-148f9a10", "1?t
    unkcid") in new stack
        -- Goto (macro-outbound-callerid,s,12)
        -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5001-148f9a10", "0|
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5001-148f9a10", "0|
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5001-148f9a10", "0|
    etCallerPres|prohib_passed_screen") in new stack
        -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/5001-148f9a10", "0|AGI|
    ixlocalprefix") in new stack
        -- Executing [s@macro-dialout-trunk:13] Set("SIP/5001-148f9a10", "OUTNUM=99
    52723100") in new stack
        -- Executing [s@macro-dialout-trunk:14] Set("SIP/5001-148f9a10", "custom=SI
    /GXW4108-CH2") in new stack
        -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5001-148f9a10", "0|Set|
    IAL_TRUNK_OPTIONS=M(setmusic^)TW") in new stack
        -- Executing [s@macro-dialout-trunk:16] Macro("SIP/5001-148f9a10", "dialout
    trunk-predial-hook|") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/5001-148
    9a10", "") in new stack
        -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/5001-148f9a10", "0?bypa
    s|1") in new stack
        -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5001-148f9a10", "0?cust
    mtrunk") in new stack
        -- Executing [s@macro-dialout-trunk:19] Dial("SIP/5001-148f9a10", "SIP/GXW4
    08-CH2/99252723100|300|TW") in new stack
        -- Called GXW4108-CH2/99252723100
        -- Got SIP response 503 "Service Unavailable" back from 192.168.1.11
        -- SIP/GXW4108-CH2-14b2ac40 is circuit-busy
      == Everyone is busy/congested at this time (1:0/1/0)
        -- Executing [s@macro-dialout-trunk:20] Goto("SIP/5001-148f9a10", "s-CONGES
    ION|1") in new stack
        -- Goto (macro-dialout-trunk,s-CONGESTION,1)
        -- Executing [s-CONGESTION@macro-dialout-trunk:1] GotoIf("SIP/5001-148f9a10
    , "1?noreport") in new stack
        -- Goto (macro-dialout-trunk,s-CONGESTION,3)
        -- Executing [s-CONGESTION@macro-dialout-trunk:3] NoOp("SIP/5001-148f9a10",
    "TRUNK Dial failed due to CONGESTION - failing through to other trunks") in new
    stack
        -- Executing [95552723100@from-internal:6] Macro("SIP/5001-148f9a10", "dial
    ut-trunk|8|52723100||") in new stack
        -- Executing [s@macro-dialout-trunk:1] Set("SIP/5001-148f9a10", "DIAL_TRUNK
    8") in new stack
        -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5001-148f9a10", "0?sub-
    incheck|s|1") in new stack
        -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5001-148f9a10", "0?disab
    etrunk|1") in new stack
        -- Executing [s@macro-dialout-trunk:4] Set("SIP/5001-148f9a10", "DIAL_NUMBE
    =52723100") in new stack
        -- Executing [s@macro-dialout-trunk:5] Set("SIP/5001-148f9a10", "DIAL_TRUNK
    OPTIONS=tr") in new stack
        -- Executing [s@macro-dialout-trunk:6] Set("SIP/5001-148f9a10", "OUTBOUND_G
    OUP=OUT_8") in new stack
        -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5001-148f9a10", "1?nomax
    ) in new stack
        -- Goto (macro-dialout-trunk,s,9)
        -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5001-148f9a10", "0?skipo
    tcid") in new stack
        -- Executing [s@macro-dialout-trunk:10] Set("SIP/5001-148f9a10", "DIAL_TRUN
    _OPTIONS=TW") in new stack
        -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5001-148f9a10", "outboun
    -callerid|8") in new stack
        -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5001-148f9a10", "0|S
    tCallerPres|") in new stack
        -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5001-148f9a10", "0|S
    t|REALCALLERIDNUM=5552723100") in new stack
        -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5001-148f9a10", "1?n
    rmcid") in new stack
        -- Goto (macro-outbound-callerid,s,6)
        -- Executing [s@macro-outbound-callerid:6] Set("SIP/5001-148f9a10", "USEROU
    CID=") in new stack
        -- Executing [s@macro-outbound-callerid:7] Set("SIP/5001-148f9a10", "EMERGE
    CYCID=") in new stack
        -- Executing [s@macro-outbound-callerid:8] Set("SIP/5001-148f9a10", "TRUNKO
    TCID=") in new stack
        -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5001-148f9a10", "1?t
    unkcid") in new stack
        -- Goto (macro-outbound-callerid,s,12)
        -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5001-148f9a10", "0|
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5001-148f9a10", "0|
    et|CALLERID(all)=") in new stack
        -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5001-148f9a10", "0|
    etCallerPres|prohib_passed_screen") in new stack
        -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/5001-148f9a10", "0|AGI|
    ixlocalprefix") in new stack
        -- Executing [s@macro-dialout-trunk:13] Set("SIP/5001-148f9a10", "OUTNUM=99
    52723100") in new stack
        -- Executing [s@macro-dialout-trunk:14] Set("SIP/5001-148f9a10", "custom=SI
    /GXW4108-CH3") in new stack
        -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5001-148f9a10", "0|Set|
    IAL_TRUNK_OPTIONS=M(setmusic^)TW") in new stack
        -- Executing [s@macro-dialout-trunk:16] Macro("SIP/5001-148f9a10", "dialout
    trunk-predial-hook|") in new stack
        -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/5001-148
    9a10", "") in new stack
        -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/5001-148f9a10", "0?bypa
    s|1") in new stack
        -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5001-148f9a10", "0?cust
    mtrunk") in new stack
        -- Executing [s@macro-dialout-trunk:19] Dial("SIP/5001-148f9a10", "SIP/GXW4
    08-CH3/99352723100|300|TW") in new stack
        -- Called GXW4108-CH3/99352723100
        -- SIP/GXW4108-CH3-14f6afe0 is ringing
        -- SIP/GXW4108-CH3-14f6afe0 answered SIP/5001-148f9a10
    
    
    The call set correctly but the monitor cant record it.

    into my manager.con i have:

    Code:
    [c2c]
    secret = c2c
    deny=0.0.0.0/0.0.0.0
    permit=127.0.0.1/255.255.255.0
    read = system,call,log,verbose,command,agent,user,originate
    write = system,call,log,verbose,command,agent,user,originate
    
    into my elastix, the extension 5001 have this configuration:

    record incoming : always
    record outgoing: always

    in my extensions_custom.conf have:

    Code:
    [record-c2dial]
    exten => _.,1,Answer
    exten => _.,n,Set(date=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)})
    exten => _.,n,MixMonitor(c2dial-${date}-${EXTEN}.wav)
    exten => _.,n,Goto(from-internal,${EXTEN},1)
    
    I dont know why all calls is recording, but when generate calls in the php script, asterisk or monitor not record the calls

    Thanks for everything
     
  10. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Your context line on your php is wrong. It should be:
    Code:
    fputs($oSocket, "Context: record-c2dial");
    
    instead of
    Code:
    fputs($oSocket, "Context: from-internalrn");
    
    Then try again, and paste the CLI output
     
  11. carlosnuel

    Joined:
    Aug 5, 2008
    Messages:
    15
    Likes Received:
    0
    Hi jgutierrez,
    I solved my problem, I did was change the Channel structure:

    I have:
    SIP/5001

    And the changed for :

    LOCAL/5001@from-internal


    and my problem are solved

    thanks for all :)
     
  12. quix

    Joined:
    Nov 1, 2014
    Messages:
    2
    Likes Received:
    0
    Hello, I am having exactly the same issue. But I can't figure out the solution yet on the
    configuration parameters. The system records calls for manually dialed numbers, but
    not for the click-to-dial calls

    Below is my script.

    <?php
    #ip address that asterisk is on.
    $strHost = "127.0.0.1";
    $strUser = "admin";#specify the asterisk manager username you want to login with
    $strSecret = "**********";#specify the password for the above user
    #specify the channel (extension) you want to receive the call requests with
    #e.g. SIP/XXX, IAX2/XXXX, ZAP/XXXX, etc
    # $strChannel = "SIP/100";
    $strChannel = $_REQUEST['exten'];
    $strContext = "from-internal";
    #specify the amount of time you want to try calling the specified channel before hangin up
    $strWaitTime = "30";
    #specify the priority you wish to place on making this call
    $strPriority = "1";
    #specify the maximum amount of retries
    $strMaxRetry = "2";
    $number=strtolower($_REQUEST['number']);
    $pos=strpos ($number,"local");
    if ($number == null) :
    exit() ;
    endif ;
    if ($pos===false) :
    $errno=0 ;
    $errstr=0 ;
    $strCallerId = "$strChannel";
    $oSocket = fsockopen ("localhost", 5038, &$errno, &$errstr, 20);
    if (!$oSocket) {
    echo "$errstr ($errno)<br>\n";
    } else {
    fputs($oSocket, "Action: login\r\n");
    fputs($oSocket, "Events: off\r\n");
    fputs($oSocket, "Username: $strUser\r\n");
    fputs($oSocket, "Secret: $strSecret\r\n\r\n");
    fputs($oSocket, "Action: originate\r\n");
    fputs($oSocket, "Account: Click2Call\r\n");
    fputs($oSocket, "Channel: $strChannel\r\n");
    fputs($oSocket, "WaitTime: $strWaitTime\r\n");
    fputs($oSocket, "CallerId: $strCallerId\r\n");
    fputs($oSocket, "Exten: $number\r\n");
    fputs($oSocket, "Context: $strContext\r\n");
    fputs($oSocket, "Priority: $strPriority\r\n\r\n");
    fputs($oSocket, "Action: Logoff\r\n\r\n");
    sleep(2);
    fclose($oSocket);
    }
    echo "<html>";
    echo "<head>";
    echo "<title>";
    echo "Dial";
    echo "</title>";
    echo "<h1>Dial</h1>";
    echo "</head>";
    echo "<body>";
    echo "</body>";
    echo "</html>";

    /* ... SQL EXECUTION TO UPDATE DB ... */

    //echo "<script>window.open('','_self','');window.close();</script>";

    echo " "; // temp
    /*
    echo "
    <script type=\"text/javascript\">
    function closeWindow() {
    setTimeout(function() {
    this.focus();
    self.opener = this;
    self.close();
    //window.close();
    }, 3000);
    }
    window.onload = closeWindow();
    </script>
    <p>Processing - window will auto-close after a pause ....<p>
    ";
    */

    else :
    exit() ;
    endif ;

    ?>
     
  13. quix

    Joined:
    Nov 1, 2014
    Messages:
    2
    Likes Received:
    0
    Carlos,

    I do not understand where (in what file) did you make the changes that solved our problem, that is:

    I solved my problem, I did was change the Channel structure:

    I have:
    SIP/5001

    And the changed for :

    LOCAL/5001@from-internal

    I will appreciate your comments since I am having the exact same issue that you solved.

    Anybody else? Comments are welcome.

    Thank you.
     

Share This Page