Logo Search packages:      
Sourcecode: capisuite version File versions  Download package

Connection::Connection ( _cmsg &  message,
Capi capi,
unsigned short  DDILength = 0,
unsigned short  DDIBaseLength = 0,
std::vector< std::string >  DDIStopNumbers = std::vector<std::string>() 
) [protected]

Constructor. Create an object for an incoming call.

This one is used by Capi when an incoming connection triggers the automatic creation of a Connection object, i.e. when we receive a CONNECT_IND message.

It only extracts some data (numbers, services, etc.) from the message and saves it in private attributes. The answer to CONNECT_IND (i.e. CONNECT_RESP) is given later by the Connection object.

Parameters:
message the received CONNECT_IND message
capi pointer to the Capi Object
DDILength set the length of DDI extension numbers (0=default means disable DDI)
DDIBaseLength the length of the base number of the PtP interface
DDIStopNumbers a vector of strings listing complete DDI extension numbers which are shorter than DDILength

Definition at line 31 of file connection.cpp.

References call_from, call_to, connect_ind_msg_nr, debug, debug_level, FAXG3, getNumber(), OTHER, plci, prefix(), receive_mutex, send_mutex, service, and VOICE.

                                                                                                                                              :
      call_if(NULL),capi(capi),plci_state(P2),ncci_state(N0), buffer_start(0), buffers_used(0),
      file_for_reception(NULL), file_to_send(NULL), received_dtmf(""), keepPhysicalConnection(false),
      disconnect_cause(0),debug(capi->debug), debug_level(capi->debug_level), error(capi->error),
      our_call(false), disconnect_cause_b3(0), fax_info(NULL), DDILength(DDILength), 
      DDIBaseLength(DDIBaseLength), DDIStopNumbers(DDIStopNumbers) 
{
      pthread_mutex_init(&send_mutex, NULL);
      pthread_mutex_init(&receive_mutex, NULL);

      plci=CONNECT_IND_PLCI(&message); // Physical Link Connection Identifier
      call_from = getNumber(CONNECT_IND_CALLINGPARTYNUMBER(&message),true);
      if (DDILength)
            call_to=""; // we enable the CalledParty InfoElement when using DDI and will get the number later again
      else
            call_to=getNumber(CONNECT_IND_CALLEDPARTYNUMBER(&message),false);

      if (debug_level >= 1) {
            debug << prefix() << "Connection object created for incoming call PLCI " << plci;
            debug << " from " << call_from << " to " << call_to << " CIP 0x" << hex << CONNECT_IND_CIPVALUE(&message) << endl;
      }
      switch (CONNECT_IND_CIPVALUE(&message)) {
            case 1:
            case 4:
            case 16:
                  service=VOICE;
            break;
            case 17:
                  service=FAXG3;
            break;
            default:
                  service=OTHER;
            break;
      }
      connect_ind_msg_nr=message.Messagenumber; // this is needed as connect_resp is given later
}


Generated by  Doxygen 1.6.0   Back to index