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

Asterisk bridges terminate both parties when one leaves #193

Closed
benlangfeld opened this issue Dec 18, 2013 · 2 comments · Fixed by #194
Closed

Asterisk bridges terminate both parties when one leaves #193

benlangfeld opened this issue Dec 18, 2013 · 2 comments · Fixed by #194
Labels

Comments

@benlangfeld
Copy link
Member

Example code:

Adhearsion.router do
  openended do
    route 'default' do
      answer
      if Adhearsion.active_calls.size > 1
        other_call = Adhearsion.active_calls.first[1]
        logger.info "We already have a call (#{other_call}). Lets join to it!"
        join other_call
      end
      logger.info "Controller terminating"
    end
  end
end

On FreeSWITCH mod_rayo (regardless of who hangs up):

[2013-12-18 14:46:18] INFO  Adhearsion::Router: Call e7f5ce8b-7052-4b96-b17f-59408dd47259 selected route "default" (#<Proc:0x007ff797386508@/Users/ben/Desktop/foo/config/adhearsion.rb:30>)
[2013-12-18 14:46:18] INFO  Adhearsion::Call: e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com: Executing controller #<Adhearsion::CallController call=e7f5ce8b-7052-4b96-b17f-59408dd47259, metadata={}>
[2013-12-18 14:46:18] INFO  Adhearsion::Call: e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com: Controller terminating
[2013-12-18 14:46:18] INFO  Adhearsion::Router::Route: Call routing completed, keeping the call alive at controller/router request.
[2013-12-18 14:46:22] INFO  Adhearsion::Router: Call fd922f64-7a7a-424c-bead-1ad234120298 selected route "default" (#<Proc:0x007ff797386508@/Users/ben/Desktop/foo/config/adhearsion.rb:30>)
[2013-12-18 14:46:22] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: Executing controller #<Adhearsion::CallController call=fd922f64-7a7a-424c-bead-1ad234120298, metadata={}>
[2013-12-18 14:46:22] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: We already have a call (e7f5ce8b-7052-4b96-b17f-59408dd47259). Lets join to it!
[2013-12-18 14:46:22] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: Joining to e7f5ce8b-7052-4b96-b17f-59408dd47259
[2013-12-18 14:46:22] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: Joined to call xmpp:e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com
[2013-12-18 14:46:22] INFO  Adhearsion::Call: e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com: Joined to call xmpp:fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com
[2013-12-18 14:46:55] INFO  Adhearsion::Call: e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com: Unjoined from call xmpp:fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com
[2013-12-18 14:46:55] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: Unjoined from call xmpp:e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com
[2013-12-18 14:46:55] INFO  Adhearsion::Call: e7f5ce8b-7052-4b96-b17f-59408dd47259@freeswitch.local-dev.mojolingo.com: Call ended due to hungup
[2013-12-18 14:46:55] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: Controller terminating
[2013-12-18 14:46:55] INFO  Adhearsion::Router::Route: Call routing completed, keeping the call alive at controller/router request.
[2013-12-18 14:47:02] INFO  Adhearsion::Call: fd922f64-7a7a-424c-bead-1ad234120298@freeswitch.local-dev.mojolingo.com: Call ended due to hungup

On Asterisk:

when call hangs up: https://gist.github.com/benlangfeld/ea9ef8a68194d7b45d01
when other_call hangs up: https://gist.github.com/benlangfeld/597662aaa5f2b3450cd6

@JustinAiken
Copy link
Member

BTW, my observance of this issue was on Asterisk 11.3

@benlangfeld
Copy link
Member Author

Turns out this only fixes the issue for inbound calls. Outbound calls still present the same problem:

Adhearsion.router do
  openended do
    route 'default' do
      answer
      logger.info "Placing outbound call"
      first_call = call
      other_call = Adhearsion::OutboundCall.originate 'SIP/usera' do
        call[:ahn_prevent_hangup] = true
        logger.info "Joining!"
        call.join first_call
      end
      logger.info "Controller terminating"
    end
  end
end

@benlangfeld benlangfeld reopened this Dec 18, 2013
sfgeorge pushed a commit to sfgeorge/punchblock that referenced this issue Mar 13, 2014
…linked lifecycles

Previously, joinees would be hungup when the joiner exited the bridge.

Fixes adhearsion#193
sfgeorge pushed a commit to sfgeorge/punchblock that referenced this issue Mar 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants