src/modules/sca/sca_call_info.h
ce6a9ca2
 /*
  * Copyright (C) 2012 Andrew Mortensen
  *
313e77d3
  * This file is part of the sca module for Kamailio, a free SIP server.
ce6a9ca2
  *
  * The sca module is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version
  *
  * The sca module is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
c1e0ba69
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce6a9ca2
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
c1e0ba69
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA. 02110-1301 USA
ce6a9ca2
  */
d694ceba
 #ifndef SCA_CALL_INFO_H
 #define SCA_CALL_INFO_H
 
 #include "sca.h"
 #include "sca_subscribe.h"
 
c1e0ba69
 // pass to sca_notify_subscriber to include all appearances in Call-Info hdr
cf3c0132
 #define SCA_CALL_INFO_APPEARANCE_INDEX_ANY 0
d694ceba
 
cf3c0132
 enum
 {
c1e0ba69
 	SCA_CALL_INFO_SHARED_NONE = 0,
 	SCA_CALL_INFO_SHARED_CALLER = (1 << 0),
 	SCA_CALL_INFO_SHARED_CALLEE = (1 << 1),
287cccf2
 };
ba5c2f97
 #define SCA_CALL_INFO_SHARED_BOTH \
 	(SCA_CALL_INFO_SHARED_CALLER | SCA_CALL_INFO_SHARED_CALLEE)
287cccf2
 
cf3c0132
 struct _sca_call_info
 {
c1e0ba69
 	str sca_uri;
 	int index;
 	int state;
 	str uri;
 	// mask tracking which endpoints in a call are shared
 	int ua_shared;
d694ceba
 };
c1e0ba69
 typedef struct _sca_call_info sca_call_info;
d694ceba
 
cf3c0132
 #define SCA_CALL_INFO_EMPTY(ci1)                                   \
 	((void *)(ci1) == NULL                                         \
 			|| ((ci1)->index == SCA_CALL_INFO_APPEARANCE_INDEX_ANY \
 					&& (ci1)->state == SCA_APPEARANCE_STATE_UNKNOWN))
287cccf2
 
cf3c0132
 #define SCA_CALL_INFO_IS_SHARED_CALLER(ci1)         \
 	(!SCA_CALL_INFO_EMPTY((ci1))                    \
 			&& (((sca_call_info *)(ci1))->ua_shared \
 					& SCA_CALL_INFO_SHARED_CALLER))
287cccf2
 
cf3c0132
 #define SCA_CALL_INFO_IS_SHARED_CALLEE(ci1)         \
 	(!SCA_CALL_INFO_EMPTY((ci1))                    \
 			&& (((sca_call_info *)(ci1))->ua_shared \
 					& SCA_CALL_INFO_SHARED_CALLEE))
287cccf2
 
c1e0ba69
 extern const str SCA_CALL_INFO_HEADER_STR;
287cccf2
 
cf3c0132
 int sca_call_info_update(sip_msg_t *, int, str *, str *);
c1e0ba69
 void sca_call_info_sl_reply_cb(void *);
 void sca_call_info_ack_cb(struct cell *, int, struct tmcb_params *);
4a61c692
 
c1e0ba69
 int sca_call_info_build_header(sca_mod *, sca_subscription *, char *, int);
cf3c0132
 int sca_call_info_append_header_for_appearance_index(
 		sca_subscription *, int, char *, int);
d694ceba
 
c1e0ba69
 int sca_call_info_body_parse(str *, sca_call_info *);
 int sca_call_info_free(sca_call_info *);
d694ceba
 
c1e0ba69
 #endif // SCA_CALL_INFO_H