Skip to content

Commit

Permalink
[BUGFIX] Send outbound calls through the dial plan to ensure post-bri…
Browse files Browse the repository at this point in the history
…dge redirect works

Fixes #193
  • Loading branch information
benlangfeld committed Dec 19, 2013
1 parent 246fecd commit d183e97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions lib/punchblock/translator/asterisk/call.rb
Expand Up @@ -74,8 +74,9 @@ def dial(dial_command)
channel = dial_command.to || ''
channel.match(OUTBOUND_CHANNEL_MATCH) { |m| channel = m[:channel] }
params = { :async => true,
:application => 'AGI',
:data => 'agi:async',
:context => REDIRECT_CONTEXT,
:exten => REDIRECT_EXTENSION,
:priority => REDIRECT_PRIORITY,
:channel => channel,
:callerid => dial_command.from
}
Expand Down
20 changes: 12 additions & 8 deletions spec/punchblock/translator/asterisk/call_spec.rb
Expand Up @@ -182,8 +182,9 @@ class Asterisk
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
:application => 'AGI',
:data => 'agi:async',
:context => REDIRECT_CONTEXT,
:exten => REDIRECT_EXTENSION,
:priority => REDIRECT_PRIORITY,
:channel => 'SIP/1234',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id}"
Expand All @@ -200,8 +201,9 @@ class Asterisk
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
:application => 'AGI',
:data => 'agi:async',
:context => REDIRECT_CONTEXT,
:exten => REDIRECT_EXTENSION,
:priority => REDIRECT_PRIORITY,
:channel => 'SIP/5678',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id}"
Expand All @@ -221,8 +223,9 @@ class Asterisk
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
:application => 'AGI',
:data => 'agi:async',
:context => REDIRECT_CONTEXT,
:exten => REDIRECT_EXTENSION,
:priority => REDIRECT_PRIORITY,
:channel => 'SIP/1234',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id}",
Expand All @@ -243,8 +246,9 @@ class Asterisk
expected_action = Punchblock::Component::Asterisk::AMI::Action.new(:name => 'Originate',
:params => {
:async => true,
:application => 'AGI',
:data => 'agi:async',
:context => REDIRECT_CONTEXT,
:exten => REDIRECT_EXTENSION,
:priority => REDIRECT_PRIORITY,
:channel => 'SIP/1234',
:callerid => 'sip:foo@bar.com',
:variable => "punchblock_call_id=#{subject.id},SIPADDHEADER51=\"X-foo: bar\",SIPADDHEADER52=\"X-doo: dah\""
Expand Down

0 comments on commit d183e97

Please sign in to comment.