Ignore:
Timestamp:
Nov 29, 2013 5:56:02 AM (10 years ago)
Author:
ming
Message:

Re #1519: Add Call API in pjsua2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/siptypes.hpp

    r4658 r4663  
    394394    unsigned                usageCount; 
    395395 
     396public: 
    396397    /** Construct from pjsua_transport_info */ 
    397398    void fromPj(const pjsua_transport_info &info); 
     
    419420 
    420421    /** 
    421      * Source IP address of the message. 
    422      */ 
    423     string              srcIp; 
    424  
    425     /** 
    426      * Source port number of the message. 
    427      */ 
    428     unsigned            srcPort; 
    429  
     422     * Source address of the message. 
     423     */ 
     424    SocketAddress       srcAddress; 
     425 
     426    /** 
     427     * Pointer to original pjsip_rx_data. Only valid when the struct 
     428     * is constructed from PJSIP's pjsip_rx_data. 
     429     */ 
     430    void               *pjRxData; 
     431 
     432public: 
    430433    /** 
    431434     * Construct from PJSIP's pjsip_rx_data 
     
    434437}; 
    435438 
     439/** 
     440 * This structure describes an outgoing SIP message. It corresponds to the 
     441 * pjsip_tx_data structure in PJSIP library. 
     442 */ 
     443struct SipTxData 
     444{ 
     445    /** 
     446     * A short info string describing the request, which normally contains 
     447     * the request method and its CSeq. 
     448     */ 
     449    string              info; 
     450     
     451    /** 
     452     * The whole message data as a string, containing both the header section 
     453     * and message body section. 
     454     */ 
     455    string              wholeMsg; 
     456     
     457    /** 
     458     * Destination address of the message. 
     459     */ 
     460    SocketAddress       dstAddress; 
     461     
     462    /** 
     463     * Pointer to original pjsip_tx_data. Only valid when the struct 
     464     * is constructed from PJSIP's pjsip_tx_data. 
     465     */ 
     466    void               *pjTxData; 
     467     
     468public: 
     469    /** 
     470     * Construct from PJSIP's pjsip_tx_data 
     471     */ 
     472    void fromPj(pjsip_tx_data &tdata); 
     473}; 
     474 
     475/** 
     476 * This structure describes SIP transaction object. It corresponds to the 
     477 * pjsip_transaction structure in PJSIP library. 
     478 */ 
     479struct SipTransaction 
     480{ 
     481    /* Transaction identification. */ 
     482    pjsip_role_e        role;           /**< Role (UAS or UAC)      */ 
     483    string              method;         /**< The method.            */ 
     484     
     485    /* State and status. */ 
     486    int                 statusCode;     /**< Last status code seen. */ 
     487    string              statusText;     /**< Last reason phrase.    */ 
     488    pjsip_tsx_state_e   state;          /**< State.                 */ 
     489     
     490    /* Messages and timer. */ 
     491    SipTxData           lastTx;         /**< Msg kept for retrans.  */ 
     492     
     493    /* Original pjsip_transaction. */ 
     494    void               *pjTransaction;  /**< pjsip_transaction.     */ 
     495     
     496public: 
     497    /** 
     498     * Construct from PJSIP's pjsip_transaction 
     499     */ 
     500    void fromPj(pjsip_transaction &tsx); 
     501}; 
     502 
     503/** 
     504 * This structure describes timer event. 
     505 */ 
     506struct TimerEvent 
     507{ 
     508    TimerEntry          entry;          /**< The timer entry.           */ 
     509}; 
     510 
     511/** 
     512 * This structure describes transaction state changed event. 
     513 */ 
     514struct TsxStateEvent 
     515{ 
     516    struct 
     517    { 
     518        SipRxData       rdata;          /**< The incoming message.      */ 
     519        SipTxData       tdata;          /**< The outgoing message.      */ 
     520        TimerEntry      timer;          /**< The timer.                 */ 
     521        pj_status_t     status;         /**< Transport error status.    */ 
     522        GenericData     data;           /**< Generic data.              */ 
     523    } src;                              /**< Event source.              */ 
     524    SipTransaction      tsx;            /**< The transaction.           */ 
     525    pjsip_tsx_state_e   prevState;      /**< Previous state.            */ 
     526    pjsip_event_id_e    type;           /**< Type of event source: 
     527                                         *     - PJSIP_EVENT_TX_MSG 
     528                                         *     - PJSIP_EVENT_RX_MSG, 
     529                                         *     - PJSIP_EVENT_TRANSPORT_ERROR 
     530                                         *     - PJSIP_EVENT_TIMER 
     531                                         *     - PJSIP_EVENT_USER 
     532                                         */ 
     533}; 
     534 
     535/** 
     536 * This structure describes message transmission event. 
     537 */ 
     538struct TxMsgEvent 
     539{ 
     540    SipTxData           tdata;          /**< The transmit data buffer.  */ 
     541}; 
     542 
     543/** 
     544 * This structure describes transmission error event. 
     545 */ 
     546struct TxErrorEvent 
     547{ 
     548    SipTxData           tdata;          /**< The transmit data.         */ 
     549    SipTransaction      tsx;            /**< The transaction.           */ 
     550}; 
     551 
     552/** 
     553 * This structure describes message arrival event. 
     554 */ 
     555struct RxMsgEvent 
     556{ 
     557    SipRxData           rdata;          /**< The receive data buffer.   */ 
     558}; 
     559 
     560/** 
     561 * This structure describes user event. 
     562 */ 
     563struct UserEvent 
     564{ 
     565    GenericData         user1;          /**< User data 1.               */ 
     566    GenericData         user2;          /**< User data 2.               */ 
     567    GenericData         user3;          /**< User data 3.               */ 
     568    GenericData         user4;          /**< User data 4.               */ 
     569}; 
     570 
     571/** 
     572 * This structure describe event descriptor to fully identify a SIP event. It 
     573 * corresponds to the pjsip_event structure in PJSIP library. 
     574 */ 
     575struct SipEvent 
     576{ 
     577    /** 
     578     * The event type, can be any value of \b pjsip_event_id_e. 
     579     */ 
     580    pjsip_event_id_e    type; 
     581     
     582    /** 
     583     * The event body, which fields depends on the event type. 
     584     */ 
     585    struct 
     586    { 
     587        /** 
     588         * Timer event. 
     589         */ 
     590        TimerEvent      timer; 
     591         
     592        /** 
     593         * Transaction state has changed event. 
     594         */ 
     595        TsxStateEvent   tsxState; 
     596         
     597        /** 
     598         * Message transmission event. 
     599         */ 
     600        TxMsgEvent      txMsg; 
     601         
     602        /** 
     603         * Transmission error event. 
     604         */ 
     605        TxErrorEvent    txError; 
     606         
     607        /** 
     608         * Message arrival event. 
     609         */ 
     610        RxMsgEvent      rxMsg; 
     611         
     612        /** 
     613         * User event. 
     614         */ 
     615        UserEvent       user; 
     616         
     617    } body; 
     618     
     619    /** 
     620     * Pointer to its original pjsip_event. Only valid when the struct is 
     621     * constructed from PJSIP's pjsip_event. 
     622     */ 
     623    void               *pjEvent; 
     624     
     625public: 
     626    /** 
     627     * Construct from PJSIP's pjsip_event 
     628     */ 
     629    void fromPj(const pjsip_event &ev); 
     630}; 
    436631 
    437632////////////////////////////////////////////////////////////////////////////// 
     
    449644    string              subType; 
    450645 
     646public: 
    451647    /** 
    452648     * Construct from PJSIP's pjsip_media_type 
     
    475671    string              hValue; 
    476672 
     673public: 
    477674    /** 
    478675     * Initiaize from PJSIP header. 
     
    514711    string              body; 
    515712 
     713public: 
    516714    /** 
    517715     * Initiaize from PJSIP's pjsip_multipart_part. 
     
    540738{ 
    541739    /** 
    542      * Optional remote target URI (i.e. Target header). If NULL, the target 
    543      * will be set to the remote URI (To header). At the moment this field 
    544      * is only used when sending initial INVITE and MESSAGE requests. 
    545      */ 
    546     string              targetUri; 
     740     * Optional remote target URI (i.e. Target header). If empty (""), the 
     741     * target will be set to the remote URI (To header). At the moment this 
     742     * field is only used when sending initial INVITE and MESSAGE requests. 
     743     */ 
     744    string                  targetUri; 
    547745 
    548746    /** 
    549747     * Additional message headers to be included in the outgoing message. 
    550748     */ 
    551     SipHeaderVector     headers; 
     749    SipHeaderVector         headers; 
    552750 
    553751    /** 
     
    555753     * in this structure. 
    556754     */ 
    557     string              contentType; 
     755    string                  contentType; 
    558756 
    559757    /** 
     
    561759     * message doesn't have a body. 
    562760     */ 
    563     string              msgBody; 
     761    string                  msgBody; 
    564762 
    565763    /** 
     
    569767     * contains a body, the body will be added to the multipart bodies. 
    570768     */ 
    571     SipMediaType        multipartContentType; 
     769    SipMediaType            multipartContentType; 
    572770 
    573771    /** 
     
    577775     * the body will be added to the multipart bodies. 
    578776     */ 
    579     SipMultipartPartVector      multipartParts; 
    580  
     777    SipMultipartPartVector  multipartParts; 
     778 
     779public: 
     780    /** 
     781     * Check if the options are empty. If the options are set with empty 
     782     * values, there will be no additional information sent with outgoing 
     783     * SIP message. 
     784     * 
     785     * @return              True if the options are empty. 
     786     */ 
     787    bool isEmpty() const; 
     788     
    581789    /** 
    582790     * Initiaize from PJSUA's pjsua_msg_data. 
     
    590798}; 
    591799 
     800////////////////////////////////////////////////////////////////////////////// 
    592801 
    593802/** 
     
    600809     * MIME type. Default is "text/plain". 
    601810     */ 
    602     string contentType; 
     811    string      contentType; 
    603812     
    604813    /** 
    605814     * The message content. 
    606815     */ 
    607     string content; 
     816    string      content; 
    608817     
    609818    /** 
     
    611820     */ 
    612821    SipTxOption txOption; 
    613  
     822     
    614823    /** 
    615824     * User data, which will be given back when the IM callback is called. 
    616825     */ 
    617     Token userData; 
     826    Token       userData; 
     827     
     828public: 
     829    /** 
     830     * Default constructor initializes with zero/empty values. 
     831     */ 
     832    SendInstantMessageParam(); 
    618833}; 
    619834 
     
    628843     * True to indicate to remote that local person is currently typing an IM. 
    629844     */ 
    630     bool isTyping; 
     845    bool         isTyping; 
    631846     
    632847    /** 
    633848     * List of headers etc to be included in outgoing request. 
    634849     */ 
    635     SipTxOption txOption; 
     850    SipTxOption  txOption; 
     851     
     852public: 
     853    /** 
     854     * Default constructor initializes with zero/empty values. 
     855     */ 
     856    SendTypingIndicationParam(); 
    636857}; 
    637858 
Note: See TracChangeset for help on using the changeset viewer.