SOLVED Check bridge transfer result

Hi all,

I am bridging some calls in my application. It all works well but I am strugling to find a way to properly deal with expected errors (e.g. non registered extensions, no answer, rejected, etc.)

This is an extract of my code:

Code:
-----------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------

device='2001'

global_system_context='my_privatedomain.org'

caller_ani=session:getVariable('caller_id_number')

target_endpoint='{ignore_early_media=true, origination_caller_id_number=' .. caller_ani ..  '}sofia/internal/' .. device .. '%' .. global_system_context

session:execute('bridge',target_endpoint);



-- Then I tried to capture these two variables:

callStatus = session:getVariable( "endpoint_disposition");

another_callStatus = session:getVariable( "hangup_cause");

-----------------------------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------------------------
However, it does not seems those are the right variables to use. This is a test where I purposely did not login the extension (2001):

bridge.png

Clearly mod_dptools sees the user as NOT_REGISTERED while my apparently the endpoint_disposition variable says the call was answered (unless it actually refers to the global call and not the bridge. The hangup_cause variable does not even get populated.

Any idea which variables I can use to check bridge status. All I want to do is to handle the call cleanly.

Thank you!
 
Last edited:
I actually found something that works for me ten minutes after I posted this. I just needed to capture the value of originate_disposition, after the bridge attempt. I tried with several failure causes and it seems to work well. Still I would be interested to know if there is a set of good practices out there.

Thanks!