Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LocalDialDescriptor class #20

Merged
merged 2 commits into from
Mar 19, 2014
Merged

Added LocalDialDescriptor class #20

merged 2 commits into from
Mar 19, 2014

Conversation

staelche
Copy link

I added a LocalDialDescriptor class to accomplish using call files to trigger automated outgoing calls + be able to set sip headers before actually placing the call.

I need this since my SIP provider needs the 'P-Preferred-Identity' header to be set to the outgoing number. With this descriptor class I generate a call file, which executes the given context and extension. This adds the sip header and calls a number I added as a custom variable. In the call file I mention the application (AGI) and the AGI script, which should be connected to the call, as well.

extensions.conf:

[test]
exten => 3000,n,SIPAddHeader(P-Preferred-Identity: <sip:0123456789@xxxx.de>)
exten => 3000,n,Dial(SIP/${NUMBER},20,L(60000))
exten => 3000,n,Hangup

Code generating the call file:

$dialDescriptor = new LocalDialDescriptor("test", "3000");  
$callFile = new CallFile($dialDescriptor);  
$callFile->setPriority(1);
$callFile->setApplication('AGI');
$callFile->setApplicationData(array('path to pagi ivr.sh'));
$callFile->setVariable('NUMBER', '9876543210@xxxx.de');

$spool = CallSpoolImpl::getInstance(array(  
    "tmpDir" => "/tmp/temporaryDirForSpool",  
    "spoolDir" => "/var/spool/asterisk"  
));  
$spool->spool($callFile);

Generated call file:

Channel: LOCAL/3000@test
Priority: 1
Application: AGI
Data: path to pagi ivr.sh
Set: NUMBER=9876543210@xxxx.de

@staelche
Copy link
Author

Sorry, I forgot to add the test case. I will do this in the next days.

@marcelog
Copy link
Owner

Looks good, thank you :) I'll be happy to merge when the unit tests are in place :)

@staelche
Copy link
Author

Already found some time :-)

marcelog added a commit that referenced this pull request Mar 19, 2014
@marcelog marcelog merged commit 4bbafea into marcelog:master Mar 19, 2014
@marcelog
Copy link
Owner

thanks! :)

@staelche staelche deleted the local-dial-descriptor branch March 19, 2014 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants