| 696 | } |
| 697 | |
| 698 | int b2bl_callback_agent(b2bl_cb_params_t *params, unsigned int event) |
| 699 | { |
| 700 | struct cc_call *call = (struct cc_call*)params->param; |
| 701 | int cnt; |
| 702 | b2bl_dlg_stat_t* stat = params->stat; |
| 703 | |
| 704 | LM_DBG(" call (%p) has BYE for event %d, \n", call, event); |
| 705 | |
| 706 | lock_set_get( data->call_locks, call->lock_idx ); |
| 707 | |
| 708 | if (event == B2B_DESTROY_CB) { |
| 709 | LM_DBG("A delete in b2blogic, call->state=%d, %p\n", call->state, call); |
| 710 | cnt = --call->ref_cnt; |
| 711 | lock_set_release( data->call_locks, call->lock_idx ); |
| 712 | if (cnt==0) |
| 713 | free_cc_call( data, call); |
| 714 | return 0; |
| 715 | } |
| 716 | |
| 717 | if(call->ign_cback) { |
| 718 | lock_set_release( data->call_locks, call->lock_idx ); |
| 719 | return 2; |
| 720 | } |
| 721 | |
| 722 | if (event == B2B_BYE_CB && params->entity == 0) { |
| 723 | /* BYE from agent */ |
| 724 | if (call->state==CC_CALL_PRE_TOAGENT) { |
| 725 | handle_agent_reject(call, 0, stat->setup_time); |
| 726 | } |
| 727 | lock_set_release( data->call_locks, call->lock_idx ); |
| 728 | /* route the BYE according to scenario */ |
| 729 | return 1; |
| 730 | } |
| 731 | |
| 732 | /* |
| 733 | * if negative reply from agent - deny call |
| 734 | */ |
| 735 | if(event == B2B_REJECT_CB && params->entity == 0) { |
| 736 | if(call->state == CC_CALL_PRE_TOAGENT) { |
| 737 | handle_agent_reject(call, 0, 0); |
| 738 | } |
| 739 | lock_set_release( data->call_locks, call->lock_idx ); |
| 740 | return 1; |
| 741 | } |
| 742 | |
| 743 | /* right-side leg of call sent BYE -> get next state */ |
| 744 | |
| 745 | if(call->state != CC_CALL_PRE_TOAGENT) { |
| 746 | LM_CRIT("State not PRE_TOAGENT\n"); |
| 747 | } |
| 748 | |
| 749 | call->state = CC_CALL_TOAGENT; |
| 750 | |
| 751 | if (stat) call->setup_time = stat->setup_time; |
| 752 | |
| 753 | /* call no longer on wait */ |
| 754 | LM_DBG("** onhold-- Bridging [%p]\n", call); |
| 755 | update_stat( stg_onhold_calls, -1); |
nothing calls this directly
no test coverage detected