О немО себе[code]/maps/Мои СоседиМой ЗимаШопМоя СтройкаЗверь Дверь
[code] | ed_line.cc.c
kMaps
4D
  SparseTileLayer.js
  auto_registrator_cc.c
  ed_line.c
  array-speed.php
  ed_line.cc.c
  codeZ.php
  time.php
  auto_registrator.c
 
#include "stdafx.h"
#include "l2_lapd.h"
@require "mpx.lua"
@include "../siglib/sys_signals.hh"
#include "../siglib/release_types.h"

 //lua function RR(a)return a;end;
 //lua function CL(a)return a;end;

#define CS_CALL_CLEAR 0


static LPCSTR EDSS_TIMER_NAME[]=
{
  
"T301",
  
"T302",
  
"T303",
  
"T304",
  
"T305",
  
"T306",
  
"T308",
  
"T309",
  
"T310",
  
"T313",
  
"T314",
  
"T316",
  
"T317",
  
"T318",
  
"T319",
  
"T321",
  
"T322"
};

static 
WORD EDSS_TIMER_INFO[]=
{
  (
1),// EDSS_T301
  
(15),// EDSS_T302
  
(30),// EDSS_T303
  
(15),// EDSS_T304
  
(4),// EDSS_T305
  
(30),// EDSS_T306
  
(4),// EDSS_T308
  
(90),// EDSS_T309
  
(20),// EDSS_T310
  
(4),// EDSS_T313
  
(4),// EDSS_T314
  
(120),// EDSS_T316
  
(90),// EDSS_T317
  
(4),// EDSS_T318
  
(4),// EDSS_T319
  
(30),// EDSS_T321
  
(4),// EDSS_T322
};

#define EDT_SET2CP              T0+0
#define EDSS_RELTIMER           T1
#define EDSS_T303               T0+2
#define EDSS_T304               T0+3
#define EDSS_T305               T0+4
#define EDSS_T306               T0+5
#define EDSS_T308               T0+6
#define EDSS_T309               T0+7
#define EDSS_T310               T0+8
#define EDSS_T313               T0+9
#define EDSS_T314               T0+10
#define EDSS_T316               T0+11
#define EDSS_T317               T0+12
#define EDSS_T318               T0+13
#define EDSS_T319               T0+14
#define EDSS_T321               T0+15
#define EDSS_T322               T0+16


@BEGIN_DECLARE_PROCESS(EDSS_LINE,"EDSS LINE")
@
FIELD(WORD,CallID       ,"CallID")
@
FIELD(WORD,Orginate     ,"Orginate")
@
FIELD(PWORD,TimerTimeOut,"Timers timeout")
@
FIELD(char,Calling[0xFF],"Call number")
@
FIELD(char,Called[0xFF] ,"Self number")
@
FIELD(BYTE,BChannel     ,"Used bchannel");
@
FIELD(WORD,AdTalking    ,"SipAD i am talking with");
@
FIELD(WORD,DAdTalking    ,"SipAD i am talking with");
@
FIELD(BYTE,LinkedWith   ,"Have sip twin");
@
FIELD(struct CF_ConnectConnectData," holds connect data");
@
FIELD(WORD,BreakOnSetup,"break on setup(due to lo channels)");
@
FIELD(enum CF_ReleaseType,BREAK_REASON,"reason break");
@
FIELD(WORD,TractReady,"is voicetract ready");
@
FIELD(WORD,VoiceConnected,"is voice on");
@
FIELD(WORD,TONP,"TractOnEvent bitmask");
@
FIELD(WORD,EnableDTMF,"Enable DTMF on request");
@
FIELD(time_t,StartTime,"TalkStartTime");
@
FIELD(WORD,DelayAlertTimer,"Delay alert timer");
@
END_DECLARE_PROCESS()

@
BEGIN_CONTEXT_TRACE()
LPCSTR oREMOTE="REMOTE";
LPCSTR oTHIS  ="THIS";
@
XML_TRACE("CallID","%s|%d",(@THIS()->Orginate?oREMOTE:oTHIS),@THIS()->CallID);
@
XML_TRACE("Calling","%s",@THIS()->Calling);
@
XML_TRACE("Called","%s",@THIS()->Called);
@
XML_TRACE("BChannel","%d",@THIS()->BChannel);
@
XML_TRACE("AdTalking","%d",@THIS()->AdTalking);
@
XML_TRACE("BreakOnSetup","%d",@THIS()->BreakOnSetup);
@
XML_TRACE("VConn","%d",@THIS()->VoiceConnected);
@
XML_TRACE("TractReady","%d",@THIS()->TractReady);
PrintAddr(siptmpBuf, @THIS()->ConnectData.Addr);
@
XML_TRACE("connect addr""%s:%d"siptmpBuf,  @THIS()->ConnectData.Port)
@
XML_TRACE("LinkedWith","%d",@THIS()->LinkedWith);

@
END_CONTEXT_TRACE()

@
BEGIN_DECLARE_STATES()
    
// General states       
    
@DEFINE_STATE(EMPTY ,"empty")
      @
DEFINE_STATE(LOCKED ,"LOCKED");
    @
DEFINE_STATE(S_U0,"UO Idle State")
    @
DEFINE_STATE(S_U1,"U1 Call initiated")
    @
DEFINE_STATE(S_U2,"U2 Overlap sending")
    @
DEFINE_STATE(S_U3,"U3 Outgoing call proceeding")
    @
DEFINE_STATE(S_U4,"U4 Call delivered")
    @
DEFINE_STATE(S_U5,"U5 Call present")
    @
DEFINE_STATE(S_U6,"U6 BAD STATE")
    @
DEFINE_STATE(S_U7,"U7 Call resived")                   
    @
DEFINE_STATE(S_U8,"U8 Connect request")
    @
DEFINE_STATE(S_U9,"U9 Incoming Call Proceeding")
    @
DEFINE_STATE(S_S1O,"U10 Active")
    @
DEFINE_STATE(S_U11,"U11 Disconnect Request")        
    @
DEFINE_STATE(S_U12,"U12 Disconnect Indication")
    @
DEFINE_STATE(S_U13,"U13")
    @
DEFINE_STATE(S_U14,"U14")
    @
DEFINE_STATE(S_U15,"U15 Suspend Request")
    @
DEFINE_STATE(S_U16,"U16")
    @
DEFINE_STATE(S_U17,"U17 Resume Request")
    @
DEFINE_STATE(S_U18,"U18")
    @
DEFINE_STATE(S_U19,"U19 Release Request")
    @
DEFINE_STATE(S_U2O,"U2O")
    @
DEFINE_STATE(S_U21,"U21")
    @
DEFINE_STATE(S_U22,"U22 Call Abort")
    @
DEFINE_STATE(S_U23,"U23")
    @
DEFINE_STATE(S_U24,"U24")
    @
DEFINE_STATE(S_U25,"U25 Overlap Receiving")
@
END_DECLARE_STATES()

static 
void ClearThisLine(BOOL WithTimers)
{
    if(
WithTimers)
     @
RESET_ALL_TIMERS();
    @
THIS()->TimerTimeOut=EDSS_TIMER_INFO;
    @
THIS()->LinkedWith=0;
    @
THIS()->AdTalking[email protected]THIS()->DAdTalking;

    
strcpy(@THIS()->Called ,"-");
    
strcpy(@THIS()->Calling,"-");
    
    @
THIS()->ConnectData.Port=0;
    if(
shedule_pCurBaseContext)
     @
SET_STATE(EMPTY);
    @
THIS()->BREAK_REASON=Release_Normal;
}


#define TUA_PROCEDING 1
#define TUA_ALLERTING 2
#define TUA_PROGRESS  4

@BEGIN_CALL_CONTEXT()
    switch(@
CODE())
    {
          case 
GET_TRACTFLAG
              *((
long*)@PBUF()) = @THIS()->TONP;
            return 
ERROR_noError;
          case 
SET_TRACTFLAG
              @
THIS()->TONP = (WORD) *((long*)@PBUF());
            return 
ERROR_noError;


          case 
GET_LineStatState
              if(@
GET_STATE()[email protected]STATE(EMPTY))
              {
               *((
long*)@PBUF())[email protected]THIS()->Orginate?3:2;
                if(@
GET_STATE()[email protected]STATE(S_S1O))*((long*)@PBUF())=4;
              }
              else                              *((
long*)@PBUF())=1;
              
//printf("GET_LineStatState\n");
            
return ERROR_noError;
          case 
GET_LineStatInCallerID
              
strcpy((LPSTR)@PBUF(),@THIS()->Calling);
            return 
ERROR_noError;
          case 
GET_LineStatOutCallerID
              
strcpy((LPSTR)@PBUF(),@THIS()->Called);
              
//printf("GET_LineStatOutCallerID\n");
            
return ERROR_noError;
          case 
GET_LineStatTimeStart
              {
                  
time_t cur_t;
                  
struct tmtt;
                  
time(&cur_t);
                  
cur_t[email protected]THIS()->StartTime;
              
                  
tt localtime(&cur_t);
                  
sprintf((LPSTR)@PBUF(), "%.2d:%.2d:%.2d"tt->tm_hourtt->tm_mintt->tm_sec);
                  return 
ERROR_noError;
              }
    }
    return 
ERROR_noSuchName;
@
END_CALL_CONTEXT()

@
BEGIN_INIT_CONTEXT()
 @
THIS()->EnableDTMF=1;

 @
THIS()->DAdTalking=5;
 @
THIS()->TONP=TUA_ALLERTING;
 
ClearThisLine(FALSE); 
 @
SET_STATE(EMPTY);
 @
THIS()->DelayAlertTimer=0;
@
END_INIT_CONTEXT()
           


static 
void FLOWMESSAGE(struct EDSS_MESSAGE *Sig);
static 
void SendLayerMessage(struct EDSS_MESSAGE *Message);

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_RESTART,LOCKED)
{
  
#define IS_REQ       (@PEVENT()->Message->Request)
  #define RMSG         (@PEVENT()->Message)
  #define GET_MIE(a)   (GET_MESSAGE_IE(@PEVENT()->Message,a))
  #define OUTMESSAGE(m,a) struct EDSS_MESSAGE m;ConstructMessage(&m,@THIS()->CallID,@THIS()->Orginate,a,@THIS()) 
}
@
END_DECLARE_SIGNAL_ACTION()


@include 
"ed_line_sys.cc";

static 
void OnRestartCondition(const struct ED_SIG_MESSAGE *Sig,struct EDSS_MESSAGE *m)
{
   
WORD RII;
   
RII=DECODE__EDSS_IE_CODE_RESTART_INDICATOR(GET_MESSAGE_IE(Sig->Message,EDSS_IE_CODE_RESTART_INDICATOR));
   {
      @
SIGNAL(ED_BCHAN_CTL,bcl);
      
bcl->From    =0xFF;
      
bcl->Use     =0;
      if(
RII==RII_ALL || RII==RII_SINGLE)
      {
       
bcl->BChanID =0xFF;
       @
SEND(bcl);
      }
      else
      {
       
struct EDSS_IE_DEF *IE=0;
       while(
IE=GET_MESSAGE_IE_EX(Sig->Message,EDSS_IE_CODE_RESTART_INDICATOR,IE))
       {
       if(
m)
        
APPENDM(m,IE);
       
bcl->BChanID =DECODE__EDSS_IE_CODE_CHANEL_ID(IE);
       @
SEND(bcl);
       }
      }
   }
}

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_RESTART)
 @
NEED_ACTION()
  if(
IS_REQ)
  {
     
SendLayerMessage(RMSG);
    
  }
  else
  {
   
   
OUTMESSAGE(m,EDSS_MSG_CODE_RESTART_ACK);
   
//first - ask same 
   
APPENDM(&m,GET_MIE(EDSS_IE_CODE_RESTART_INDICATOR));
   
OnRestartCondition(@PEVENT(),&m);
   
//n send
   
FLOWMESSAGE(&m);
  }
 
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_RESTART_ACK)
if(
IS_REQ)
 
SendLayerMessage(RMSG);
else 
 
//SEND_Release(0);
{
    
OnRestartCondition(@PEVENT(),0);
    
}
KILLSELF();
@
END_DECLARE_SIGNAL_ACTION()




@
BEGIN_DECLARE_SIGNAL_ACTION(KL_START)
 
ClearThisLine(TRUE);
 
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(KL_STOP)
 
ClearThisLine(TRUE);
@
END_DECLARE_SIGNAL_ACTION()






@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_SETUP,S_U0)

 if(
IS_REQ)
 {
  
SendLayerMessage(RMSG);
  
StartTimer(EDSS_T303);
  @
SET_STATE(S_U1);
 }
 else
 {
     
//Indication(EDSS_SETUP_IND,@PEVENT());
     
OnSetupLine(@PEVENT());
     
//StartTimer(EDSS_T303);
     
@SET_STATE(S_U1);
 }
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_SETUP)
@
TRACE_OFF_FLAG()
@
TRACE("GOT SECOND SETUP.. ignore")
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_DISCONNECT)
 
UpBreak();
 if(
IS_REQ)
 {
  
SendLayerMessage(RMSG);
  @
SET_STATE(S_U11);
  
StartTimer(EDSS_T305);
 }
 else
 {
     
ReleaseLink(CS_CALL_CLEAR);
     @
SET_STATE(S_U12);
 }
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_STATUS)
 if(@
THIS()->CallID)SEND_ReleaseCmp();
    
KILLSELF();
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_RELEASE)
  
UpBreak();
 if(
IS_REQ)
 {
     
SendLayerMessage(RMSG);
     
StopTimer(EDSS_T305);
     
StartTimer(EDSS_T308);
     @
SET_STATE(S_U19);
 }
 else
 {
  
SEND_ReleaseCmp();
  
KILLSELF();
 }
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSS_T305)    // WHERE WAS NO ASK FOR DISCONNECT
 
if(@GET_STATE()[email protected]STATE(S_U11))
     {
       
ReleaseLink(0);
      
/*OUTMESSAGE(m,EDSS_MSG_CODE_CALL_PROCEEDING);
      APPENDM(&m,CONSTRUCT__EDSS_IE_CODE_CHANEL_ID(@THIS()->BChannel));
      INJECT(&m);
      */
     
}
 else
     {
      @
TRACE("T305(DISC) ENDS IN WRONG STATE.AND HOW IT HAPENDS?");
     }
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSS_T308)// WHERE WAS NO ASK FOR RELEASE
 
if(@GET_STATE()[email protected]STATE(S_U19))
     {
      
SEND_ReleaseCmp();
      
KILLSELF();
     }
 else
     {
      @
TRACE("T308(RELEASE) ENDS IN WRONG STATE.AND HOW IT HAPENDS?");
     }
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_RELEASE_COMPLETE)
 @
SET_TIMER(EDSS_RELTIMER,0)
 if(
IS_REQ)
 {
     
SendLayerMessage(RMSG);
 }
 else
 {
     
 }
 
KILLSELF();
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_SETUP,LOCKED)
 @
THIS()->AdTalking[email protected]AD();
 @
THIS()->LinkedWith=1;
 if(@
THIS()->BreakOnSetup)
 {
  
KILLSELF();
  return;
 }
 @
SET_STATE(S_U0);
 
 {
    
// Запрашиваем преобразование номера
    
@SIGNAL(RT_REPLACE_RQrq);
    
rq->Hook 100;
    
strcpy(rq->Set, @PEVENT()->To);
    
strcpy(@THIS()->Calling, @PEVENT()->To);
    @
NEXT_SYNC()
 }
 
SetupLine(@PEVENT()->From,@THIS()->Calling,1);

@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(RT_REPLACED)
    
strcpy(@THIS()->Calling, @PEVENT()->Set);
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(RT_NOTRESOLVED)
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(RT_NOTCOMPLETED)
 
StopTimer(EDT_SET2CP);
 
OUTMESSAGE(m,EDSS_MSG_CODE_SETUP_ACK);
 
//APPENDM(&m,CONSTRUCT__EDSS_IE_CODE_CHANEL_ID(@THIS()->BChannel));
 
FLOWMESSAGE(&m);
 
//StopTimer(EDSS_T304);
@END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_SETUP)
 @
THIS()->AdTalking[email protected]AD();
 @
THIS()->LinkedWith=1;
 @
TRACE("EDL:line%d got CF_SETUP not in LOCKED state",@CONTEXT());
 
KILLSELF();
@
END_DECLARE_SIGNAL_ACTION()



@
BEGIN_DECLARE_SIGNAL_ACTION(EDSS_RELTIMER)//,LOCKED)
SEND_ReleaseCmp();
KILLSELF();
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_RELEASE)
 @
TRACE("incoming release");

 
LineBreakRelease();
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_TRYNING)
 
OUTMESSAGE(m,EDSS_MSG_CODE_CALL_PROCEEDING);
 
APPENDM(&m,CONSTRUCT__EDSS_IE_CODE_CHANEL_ID(@THIS()->BChannel));
 
FLOWMESSAGE(&m);
 
StopTimer(EDSS_T304);
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_COMPLETED)

 
OUTMESSAGE(m,EDSS_MSG_CODE_CALL_PROCEEDING);
 
APPENDM(&m,CONSTRUCT__EDSS_IE_CODE_CHANEL_ID(@THIS()->BChannel));
 
FLOWMESSAGE(&m);
 
StopTimer(EDSS_T304);
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(CF_NOTCOMPLETED)
 
OUTMESSAGE(m,EDSS_MSG_CODE_SETUP_ACK);
 
SendLayerMessage(&m);
 if(@
THIS()->EnableDTMF)
     
ToneCTL(EDT_DTMF_ON);
 
StartTimer(EDSS_T304);
 @
SET_STATE(S_U2);
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSS_T304)    // dial time ends. no number assepted
 
@TRACE("dial time ends. no number assepted");
 
KILLSELF();
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_SETUP_ACK)
 @
SIGNAL(CF_NOTCOMPLETED,nc);
 @
SEND(nc,@THIS()->AdTalking)
 @
SET_STATE(S_U2);
 
//ToneCTL(EDT_DTMF_ON);
@END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_PROGRESS)
 @
SIGNAL(CF_PROGRESS,nc);
 @
SEND(nc,@THIS()->AdTalking)
 
TryUpTransfer(TUA_PROGRESS);
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_INFORMATION)
 
struct EDSS_IE_DEF *CN=GET_MESSAGE_IE(@PEVENT()->Message,EDSS_IE_CODE_CALLED_PARTY_NUM);
 if(
CN)
 {
  
LPCSTR To;
  @
SIGNAL(CF_DIGITS,dg);
  
To  =DECODE__EDSS_IE_CODE_CALLED_PARTY_NUM(CN);
  
strcpy(dg->Set,To);
  @
SEND(dg,@THIS()->AdTalking);
  
RestartTimer(EDSS_T304);
 }
@
END_DECLARE_SIGNAL_ACTION() 

@
BEGIN_DECLARE_SIGNAL_ACTION(CF_DIGITS)
 if(@
AD()==8)
 {
  @
SIGNAL(CF_DIGITS,dg);
  
memcpy(dg,@PEVENT(),sizeof(*dg));
  @
SEND(dg,@THIS()->AdTalking);
  return;
 }

 if(
strlen(@PEVENT()->Set)==&& *(@PEVENT()->Set)=='#')
 {
 }
 else
 {
  
OUTMESSAGE(m,EDSS_MSG_CODE_INFORMATION);
  
strcat(@THIS()->Calling,@PEVENT()->Set);
  
APPENDM(&m,CONSTRUCT__EDSS_IE_CODE_CALLED_PARTY_NUM(@PEVENT()->Set));
  
SendLayerMessage(&m);
 }
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(CF_QUEUED)
 
OUTMESSAGE(m,EDSS_MSG_CODE_ALERTING);
 
SendLayerMessage(&m);
 
TryUpTransfer(TUA_ALLERTING);
 
ToneCTL(EDT_TONE_QUE);
 @
SET_STATE(S_U4);
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_RINGING)
 
OUTMESSAGE(m,EDSS_MSG_CODE_ALERTING);
 
SendLayerMessage(&m);
 
TryUpTransfer(TUA_ALLERTING);
 
ToneCTL(EDT_TONE_RNG);
 
StopTimer(EDSS_T304);
 @
SET_STATE(S_U4);
@
END_DECLARE_SIGNAL_ACTION()



@
BEGIN_DECLARE_SIGNAL_ACTION(CF_PROGRESS)
 
OUTMESSAGE(m,EDSS_MSG_CODE_PROGRESS);
 
SendLayerMessage(&m);
 
TryUpTransfer(TUA_PROGRESS);
 
StopTimer(EDSS_T304);
 
//ToneCTL(EDT_TONE_RNG);
 //SET_STATE(S_U4);
@END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(CF_ANSWER)
 
OUTMESSAGE(m,EDSS_MSG_CODE_CONNECT);
 
SendLayerMessage(&m);
 
StopTimer(EDSS_T304);
 @
SET_STATE(S_S1O);
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_ALERTING)
  @
SIGNAL(CF_RINGING,cfs);
  @
SEND(cfs,@THIS()->AdTalking);
  
TRYCHANGECHANNEL(@PEVENT());
  
TryUpTransfer(TUA_ALLERTING);
  @
SET_STATE(S_U4);
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_CONNECT)
{
  @
SIGNAL(CF_ANSWER,cfs);
  @
SEND(cfs,@THIS()->AdTalking);
}
 
TRYCHANGECHANNEL(@PEVENT());
{
 
OUTMESSAGE(m,EDSS_MSG_CODE_CONNECT_ACK);
 
SendLayerMessage(&m);
}
  @
THIS()->TractReady=TRUE;
  
SetUpTransfer();
  
ToneCTL(EDT_TONE_OFF);
  @
SET_STATE(S_S1O);
  
time(&(@THIS()->StartTime));
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_CONNECT_ACK)
  @
SIGNAL(CF_ANSWER,cfs);
  @
SEND(cfs,@THIS()->AdTalking);
  @
THIS()->TractReady=TRUE;
  
TRYCHANGECHANNEL(@PEVENT());
  
SetUpTransfer();
  
ToneCTL(EDT_TONE_OFF);
  @
SET_STATE(S_S1O);
  
time(&(@THIS()->StartTime));
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_CALL_PROCEEDING)
if(
IS_REQ)
 
SendLayerMessage(RMSG);
else
{
  @
SIGNAL(CF_TRYNING,cfs);
  @
SEND(cfs,@THIS()->AdTalking);
  @
SET_STATE(S_U3);
  
TRYCHANGECHANNEL(@PEVENT());
}
@
END_DECLARE_SIGNAL_ACTION()


@
BEGIN_DECLARE_SIGNAL_ACTION(ED_BCHAN_USE)
  @
THIS()->BChannel[email protected]PEVENT()->BChanID;
  @
TRACE("EDL:line%d use channel %d",@CONTEXT(),@THIS()->BChannel);
  
SetUpTransfer();
@
END_DECLARE_SIGNAL_ACTION()

@
BEGIN_DECLARE_SIGNAL_ACTION(CF_CONNECT)
 
//control channel
@SIGNAL(CF_ECHO_ONecho_on)
@
SIGNAL(CF_ECHO_OFFecho_off)
 
memcpy(&@THIS()->ConnectData,@PEVENT(),sizeof(@THIS()->ConnectData));
 @
TRACE("connect info set to line");
 
SetUpTransfer();
 if(@
PEVENT()->Codec!=G711a
    { @
SEND(echo_on) }
 else if(@
PEVENT()->Echo)
    { @
SEND(echo_on) } 
 else 
    { @
SEND(echo_off) }
@
END_DECLARE_SIGNAL_ACTION()   


@
BEGIN_DECLARE_SIGNAL_ACTION(CF_HOLD)
    if(@
THIS()->BChannel)
    {
        @
SIGNAL(CF_HOLD,cpc);   
        @
NEXT_CONTEXT(@THIS()->BChannel)
        @
SEND(cpc,8);
    }   
@
END_DECLARE_SIGNAL_ACTION()   

@
BEGIN_DECLARE_SIGNAL_ACTION(CF_UNHOLD)
    if(@
THIS()->BChannel)
    {
        @
SIGNAL(CF_UNHOLD,cpc);   
        @
NEXT_CONTEXT(@THIS()->BChannel)
        @
SEND(cpc,8);
    }   
@
END_DECLARE_SIGNAL_ACTION()   



@
BEGIN_DECLARE_SIGNAL_ACTION(EDSIG_SUSPEND)
 
OUTMESSAGE(m,EDSIG_SUSPEND_REJ);
 
SendLayerMessage(&m);
@
END_DECLARE_SIGNAL_ACTION()









[CODE]/ed_line.cc.c

Вышел Кащей Бессмертный утром на крыльцо и сначала почесал сундук, зайца и утку..