787
796
print_bc_info(fd, help, bc);
789
798
if (help->state == MISDN_HOLDED) {
790
chan_misdn_log(0, 0, "ITS A HOLDED BC:\n");
791
chan_misdn_log(0,0," --> l3_id: %x\n"
799
chan_misdn_log(2, 0, "ITS A HOLDED BC:\n");
800
chan_misdn_log(2,0," --> l3_id: %x\n"
792
801
" --> dad:%s oad:%s\n"
1410
1418
misdn_cfg_get( port, MISDN_CFG_SENDDTMF, &bc->send_dtmf, sizeof(int));
1412
1420
misdn_cfg_get( port, MISDN_CFG_NEED_MORE_INFOS, &bc->need_more_infos, sizeof(int));
1421
misdn_cfg_get( port, MISDN_CFG_NTTIMEOUT, &ch->nttimeout, sizeof(int));
1414
1423
misdn_cfg_get( port, MISDN_CFG_FAR_ALERTING, &ch->far_alerting, sizeof(int));
1626
1635
chan_misdn_log(1, port, "* CALL: %s\n",dest);
1628
chan_misdn_log(1, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
1637
chan_misdn_log(2, port, " --> * dad:%s tech:%s ctx:%s\n",ast->exten,ast->name, ast->context);
1630
1639
chan_misdn_log(3, port, " --> * adding2newbc ext %s\n",ast->exten);
1631
1640
if (ast->exten) {
1848
chan_misdn_log(1, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
1857
chan_misdn_log(5, p->bc->port, "* IND : Indication [%d] from %s\n",cond, ast->exten);
1850
1859
switch (cond) {
1851
1860
case AST_CONTROL_BUSY:
1852
chan_misdn_log(1, p->bc->port, "* IND :\tbusy\n");
1853
chan_misdn_log(1, p->bc->port, " --> * SEND: State Busy pid:%d\n",p->bc?p->bc->pid:-1);
1861
chan_misdn_log(1, p->bc->port, "* IND :\tbusy pid:%d\n",p->bc?p->bc->pid:-1);
1854
1862
ast_setstate(ast,AST_STATE_BUSY);
1856
1864
p->bc->out_cause=17;
1865
1873
case AST_CONTROL_RING:
1866
chan_misdn_log(1, p->bc->port, " --> * IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
1874
chan_misdn_log(1, p->bc->port, "* IND :\tring pid:%d\n",p->bc?p->bc->pid:-1);
1870
1878
case AST_CONTROL_RINGING:
1879
chan_misdn_log(1, p->bc->port, "* IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
1871
1880
switch (p->state) {
1872
1881
case MISDN_ALERTING:
1873
chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
1882
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but I was Ringing before, so ignoreing it\n",p->bc?p->bc->pid:-1);
1875
1884
case MISDN_CONNECTED:
1876
chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
1885
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d but Connected, so just send TONE_ALERTING without state changes \n",p->bc?p->bc->pid:-1);
1880
1889
p->state=MISDN_ALERTING;
1881
chan_misdn_log(1, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
1890
chan_misdn_log(2, p->bc->port, " --> * IND :\tringing pid:%d\n",p->bc?p->bc->pid:-1);
1882
1891
misdn_lib_send_event( p->bc, EVENT_ALERTING);
1884
1893
if (p->other_ch && p->other_ch->bc) {
1885
1894
if (misdn_inband_avail(p->other_ch->bc)) {
1886
chan_misdn_log(1,p->bc->port, " --> other End is mISDN and has inband info available\n");
1895
chan_misdn_log(2,p->bc->port, " --> other End is mISDN and has inband info available\n");
1890
1899
if (!p->other_ch->bc->nt) {
1891
chan_misdn_log(1,p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
1900
chan_misdn_log(2,p->bc->port, " --> other End is mISDN TE so it has inband info for sure (?)\n");
1896
chan_misdn_log(1, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
1905
chan_misdn_log(3, p->bc->port, " --> * SEND: State Ring pid:%d\n",p->bc?p->bc->pid:-1);
1897
1906
ast_setstate(ast,AST_STATE_RINGING);
1899
1908
if ( !p->bc->nt && (p->orginator==ORG_MISDN) && !p->incoming_early_audio )
1900
chan_misdn_log(1,p->bc->port, " --> incoming_early_audio off\n");
1909
chan_misdn_log(2,p->bc->port, " --> incoming_early_audio off\n");
1957
1966
chan_misdn_log(1, p->bc->port, " --> *\tUNHOLD pid:%d\n",p->bc?p->bc->pid:-1);
1960
ast_log(LOG_NOTICE, " --> * Unknown Indication:%d pid:%d\n",cond,p->bc?p->bc->pid:-1);
1969
chan_misdn_log(1, p->bc->port, " --> * Unknown Indication:%d pid:%d\n",cond,p->bc?p->bc->pid:-1);
2036
2045
chan_misdn_log(1, bc->port, "* IND : HANGUP\tpid:%d ctx:%s dad:%s oad:%s State:%s\n",p->bc?p->bc->pid:-1, ast->context, ast->exten, AST_CID_P(ast), misdn_get_ch_state(p));
2037
chan_misdn_log(2, bc->port, " --> l3id:%x\n",p->l3id);
2038
chan_misdn_log(1, bc->port, " --> cause:%d\n",bc->cause);
2039
chan_misdn_log(1, bc->port, " --> out_cause:%d\n",bc->out_cause);
2040
chan_misdn_log(1, bc->port, " --> state:%s\n", misdn_get_ch_state(p));
2046
chan_misdn_log(3, bc->port, " --> l3id:%x\n",p->l3id);
2047
chan_misdn_log(3, bc->port, " --> cause:%d\n",bc->cause);
2048
chan_misdn_log(2, bc->port, " --> out_cause:%d\n",bc->out_cause);
2049
chan_misdn_log(2, bc->port, " --> state:%s\n", misdn_get_ch_state(p));
2042
2051
switch (p->state) {
2043
2052
case MISDN_CALLING:
2338
2347
/* got hangup .. */
2341
chan_misdn_log(1,ch1->bc->port,"Read Null Frame\n");
2350
chan_misdn_log(4,ch1->bc->port,"Read Null Frame\n");
2343
chan_misdn_log(1,ch1->bc->port,"Read Frame Controll class:%d\n",f->subclass);
2352
chan_misdn_log(4,ch1->bc->port,"Read Frame Controll class:%d\n",f->subclass);
2945
cb_log(1,port,"hangup_chan\n");
2957
cb_log(5,port,"hangup_chan called\n");
2947
2959
if (ch->need_hangup)
2949
cb_log(1,port,"-> hangup\n");
2961
cb_log(2,port," --> hangup\n");
2950
2962
send_cause2ast(ch->ast,ch->bc,ch);
2951
2963
ch->need_hangup=0;
2952
2964
ch->need_queue_hangup=0;
2967
2979
ast_queue_hangup(ch->ast);
2968
cb_log(1,port,"-> queue_hangup\n");
2980
cb_log(2,port," --> queue_hangup\n");
2970
2982
cb_log(1,port,"Cannot hangup chan, no ast\n");
3164
3176
tmp=pbx_builtin_getvar_helper(chan,"MISDN_PID");
3166
3178
ch->other_pid=atoi(tmp);
3167
chan_misdn_log(1,bc->port,"IMPORT_PID: importing pid:%s\n",tmp);
3179
chan_misdn_log(3,bc->port," --> IMPORT_PID: importing pid:%s\n",tmp);
3169
3181
if (ch->other_pid >0) {
3170
3182
ch->other_ch=find_chan_by_pid(cl_te,ch->other_pid);
3171
3183
if (ch->other_ch) ch->other_ch->other_ch=ch;
3187
tmp=pbx_builtin_getvar_helper(chan,"MISDN_ADDRESS_COMPLETE");
3188
if (tmp && (atoi(tmp) == 1)) {
3189
bc->sending_complete=1;
3176
3193
void export_ch(struct ast_channel *chan, struct misdn_bchannel *bc, struct chan_list *ch)
3180
chan_misdn_log(1,bc->port,"EXPORT_PID: pid:%d\n",bc->pid);
3197
chan_misdn_log(3,bc->port," --> EXPORT_PID: pid:%d\n",bc->pid);
3181
3198
sprintf(tmp,"%d",bc->pid);
3182
3199
pbx_builtin_setvar_helper(chan,"_MISDN_PID",tmp);
3201
if (bc->sending_complete) {
3202
sprintf(tmp,"%d",bc->sending_complete);
3203
pbx_builtin_setvar_helper(chan,"MISDN_ADDRESS_COMPLETE",tmp);
3717
3739
ast_queue_control(ch->ast, AST_CONTROL_RINGING);
3718
3740
ast_setstate(ch->ast, AST_STATE_RINGING);
3720
cb_log(1,bc->port,"Set State Ringing\n");
3742
cb_log(7,bc->port," --> Set State Ringing\n");
3722
3744
if ( misdn_cap_is_speech(bc->capability) && misdn_inband_avail(bc)) {
3723
3745
cb_log(1,bc->port,"Starting Tones, we have inband Data\n");
3724
3746
start_bc_tones(ch);
3726
cb_log(1,bc->port,"We have no inband Data, the other end must create ringing\n");
3748
cb_log(3,bc->port," --> We have no inband Data, the other end must create ringing\n");
3727
3749
if (ch->far_alerting) {
3728
cb_log(1,bc->port,"The other end can not do ringing eh ?.. we must do all ourself..");
3750
cb_log(1,bc->port," --> The other end can not do ringing eh ?.. we must do all ourself..");
3729
3751
start_bc_tones(ch);
3730
3752
/*tone_indicate(ch, TONE_FAR_ALERTING);*/
3923
3946
int ret=write(ch->pipe[1], bc->bframe, bc->bframe_len);
3926
chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s)\n",strerror(errno));
3949
chan_misdn_log(-1, bc->port, "Write returned <=0 (err=%s) --> hanging up channel\n",strerror(errno));
3929
3956
chan_misdn_log(1, bc->port, "Wripe Pipe full!\n");