Ignore:
Timestamp:
May 28, 2006 2:58:12 PM (18 years ago)
Author:
bennylp
Message:

More changes in pjsua API to make it more complete high level API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_imp.h

    r476 r482  
    2222 
    2323 
     24 
     25 
     26/**  
     27 * Structure to be attached to invite dialog.  
     28 * Given a dialog "dlg", application can retrieve this structure 
     29 * by accessing dlg->mod_data[pjsua.mod.id]. 
     30 */ 
     31struct pjsua_call 
     32{ 
     33    unsigned             index;     /**< Index in pjsua array.              */ 
     34    pjsip_inv_session   *inv;       /**< The invite session.                */ 
     35    pj_time_val          start_time;/**< First INVITE sent/received.        */ 
     36    pj_time_val          res_time;  /**< First response sent/received.      */ 
     37    pj_time_val          conn_time; /**< Connected/confirmed time.          */ 
     38    pj_time_val          dis_time;  /**< Disconnect time.                   */ 
     39    int                  acc_index; /**< Account index being used.          */ 
     40    pjmedia_session     *session;   /**< The media session.                 */ 
     41    unsigned             conf_slot; /**< Slot # in conference bridge.       */ 
     42    pjsip_evsub         *xfer_sub;  /**< Xfer server subscription, if this 
     43                                         call was triggered by xfer.        */ 
     44    pjmedia_sock_info    skinfo;    /**< Preallocated media sockets.        */ 
     45    pjmedia_transport   *med_tp;    /**< Media transport.                   */ 
     46    void                *app_data;  /**< Application data.                  */ 
     47    pj_timer_entry       refresh_tm;/**< Timer to send re-INVITE.           */ 
     48    pj_timer_entry       hangup_tm; /**< Timer to hangup call.              */ 
     49}; 
     50 
     51typedef struct pjsua_call pjsua_call; 
     52 
     53 
     54/** 
     55 * Buddy data. 
     56 */ 
     57struct pjsua_buddy 
     58{ 
     59    unsigned             index;     /**< Buddy index.                   */ 
     60    pj_str_t             name;      /**< Buddy name.                    */ 
     61    pj_str_t             display;   /**< Buddy display name.            */ 
     62    pj_str_t             host;      /**< Buddy host.                    */ 
     63    unsigned             port;      /**< Buddy port.                    */ 
     64    int                  acc_index; /**< Which account to use.          */ 
     65    pj_bool_t            monitor;   /**< Should we monitor?             */ 
     66    pjsip_evsub         *sub;       /**< Buddy presence subscription    */ 
     67    pjsip_pres_status    status;    /**< Buddy presence status.         */ 
     68}; 
     69 
     70typedef struct pjsua_buddy pjsua_buddy; 
     71 
     72 
     73/** 
     74 * Server presence subscription list head. 
     75 */ 
     76struct pjsua_srv_pres 
     77{ 
     78    PJ_DECL_LIST_MEMBER(struct pjsua_srv_pres); 
     79    pjsip_evsub     *sub; 
     80    char            *remote; 
     81}; 
     82 
     83typedef struct pjsua_srv_pres pjsua_srv_pres; 
     84 
     85 
     86 
     87/** 
     88 * Account 
     89 */ 
     90struct pjsua_acc 
     91{ 
     92    int              index;         /**< Index in accounts array.       */ 
     93    pj_str_t         user_part;     /**< User part of local URI.        */ 
     94    pj_str_t         host_part;     /**< Host part of local URI.        */ 
     95 
     96    pjsip_regc      *regc;          /**< Client registration session.   */ 
     97    pj_timer_entry   reg_timer;     /**< Registration timer.            */ 
     98    pj_status_t      reg_last_err;  /**< Last registration error.       */ 
     99    int              reg_last_code; /**< Last status last register.     */ 
     100 
     101    pjsip_route_hdr  route_set;     /**< Route set.                     */ 
     102 
     103    pj_bool_t        online_status; /**< Our online status.             */ 
     104    pjsua_srv_pres   pres_srv_list; /**< Server subscription list.      */ 
     105 
     106    void            *app_data;      /**< Application data.              */ 
     107}; 
     108 
     109 
     110/** 
     111 * @see pjsua_acc 
     112 */ 
     113typedef struct pjsua_acc pjsua_acc; 
     114 
     115 
     116/* PJSUA application variables. */ 
     117struct pjsua 
     118{ 
     119    /* Control: */ 
     120    pj_caching_pool  cp;            /**< Global pool factory.           */ 
     121    pjsip_endpoint  *endpt;         /**< Global endpoint.               */ 
     122    pj_pool_t       *pool;          /**< pjsua's private pool.          */ 
     123    pjsip_module     mod;           /**< pjsua's PJSIP module.          */ 
     124 
     125     
     126    /* Config: */ 
     127    pjsua_config    config;         /**< PJSUA configs                  */ 
     128 
     129    /* Application callback 
     130    : */ 
     131    pjsua_callback  cb;             /**< Application callback.          */ 
     132 
     133    /* Media:  */ 
     134    pjmedia_endpt   *med_endpt;     /**< Media endpoint.                */ 
     135    unsigned         clock_rate;    /**< Conference bridge's clock rate.*/ 
     136    unsigned         samples_per_frame; /**< Bridge's frame size.       */ 
     137    pjmedia_conf    *mconf;         /**< Media conference.              */ 
     138     
     139    pjmedia_snd_port *snd_port;     /**< Sound device port.             */ 
     140    pjmedia_master_port *master_port; /**< Master port, when no snd dev */ 
     141     
     142    unsigned         player_cnt;    /**< Number of file player.         */ 
     143 
     144    /** Array of file players */ 
     145    struct { 
     146        unsigned     slot;          /**< WAV player slot in bridge      */ 
     147        pjmedia_port *port;         /**< WAV player port.               */ 
     148    } player[32]; 
     149 
     150    unsigned         recorder_cnt;  /**< Number of file recorders.      */ 
     151 
     152    /** Array of file recorders */ 
     153    struct { 
     154        unsigned     slot;          /**< Slot # in conf bridge.         */ 
     155        pjmedia_port *port;         /**< The recorder media port.       */ 
     156    } recorder[32]; 
     157 
     158    /* Account: */ 
     159    pjsua_acc        acc[PJSUA_MAX_ACC];    /** Client regs array.      */ 
     160 
     161 
     162    /* Threading (optional): */ 
     163    pj_thread_t     *threads[8];    /**< Thread instances.              */ 
     164    pj_bool_t        quit_flag;     /**< To signal thread to quit.      */ 
     165 
     166    /* Transport (UDP): */ 
     167    pj_sock_t        sip_sock;      /**< SIP UDP socket.                */ 
     168    pj_sockaddr_in   sip_sock_name; /**< Public/STUN UDP socket addr.   */ 
     169 
     170 
     171    /* PJSUA Calls: */ 
     172    unsigned         call_cnt;      /**< Number of calls.               */ 
     173    pjsua_call       calls[PJSUA_MAX_CALLS];    /** Calls array.        */ 
     174 
     175 
     176    /* SIMPLE and buddy status: */ 
     177    pjsua_buddy      buddies[PJSUA_MAX_BUDDIES]; 
     178}; 
     179 
     180 
     181/** PJSUA instance. */ 
     182extern struct pjsua pjsua; 
     183 
     184 
     185 
    24186/** 
    25187 * Find account for incoming request. 
Note: See TracChangeset for help on using the changeset viewer.