asterisk trunk API adaptions
This commit is contained in:
parent
d2094b25b7
commit
bf1eb50548
1
CHANGES
1
CHANGES
|
@ -6,6 +6,7 @@ HEAD
|
|||
- corrected check for Info value on CONNECT_B3_CONF
|
||||
- fixed NULL-pointer in cid_name (asterisk 1.6 pickup revealed this)
|
||||
- changed action on prodding in .write function to ignore it
|
||||
- API adaptions to new asterisk trunk
|
||||
|
||||
chan_capi-1.1.4
|
||||
------------------
|
||||
|
|
72
chan_capi.c
72
chan_capi.c
|
@ -177,7 +177,11 @@ static char capi_subscriber_prefix[AST_MAX_EXTENSION];
|
|||
|
||||
static char default_language[MAX_LANGUAGE] = "";
|
||||
|
||||
#ifdef CC_AST_HAS_FORMAT_T
|
||||
format_t capi_capability = AST_FORMAT_ALAW;
|
||||
#else
|
||||
int capi_capability = AST_FORMAT_ALAW;
|
||||
#endif
|
||||
|
||||
static int null_plci_dtmf_support = 1;
|
||||
|
||||
|
@ -791,7 +795,7 @@ static int local_queue_frame(struct capi_pvt *i, struct ast_frame *f)
|
|||
if ((i->state == CAPI_STATE_DISCONNECTING) ||
|
||||
(i->isdnstate & CAPI_ISDN_STATE_HANGUP)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_4 "%s: no queue_frame in state disconnecting for %d/%d\n",
|
||||
i->vname, f->frametype, f->subclass);
|
||||
i->vname, f->frametype, FRAME_SUBCLASS_INTEGER(f->subclass));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -800,7 +804,7 @@ static int local_queue_frame(struct capi_pvt *i, struct ast_frame *f)
|
|||
}
|
||||
|
||||
if ((f->frametype == AST_FRAME_CONTROL) &&
|
||||
(f->subclass == AST_CONTROL_HANGUP)) {
|
||||
(FRAME_SUBCLASS_INTEGER(f->subclass) == AST_CONTROL_HANGUP)) {
|
||||
i->isdnstate |= CAPI_ISDN_STATE_HANGUP;
|
||||
}
|
||||
|
||||
|
@ -1068,7 +1072,11 @@ static void interface_cleanup(struct capi_pvt *i)
|
|||
|
||||
i->rtpcodec = 0;
|
||||
if (i->rtp) {
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
ast_rtp_instance_destroy(i->rtp);
|
||||
#else
|
||||
ast_rtp_destroy(i->rtp);
|
||||
#endif
|
||||
i->rtp = NULL;
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1170,7 @@ static void send_progress(struct capi_pvt *i)
|
|||
|
||||
if (!(i->isdnstate & CAPI_ISDN_STATE_PROGRESS)) {
|
||||
i->isdnstate |= CAPI_ISDN_STATE_PROGRESS;
|
||||
fr.subclass = AST_CONTROL_PROGRESS;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_PROGRESS;
|
||||
local_queue_frame(i, &fr);
|
||||
}
|
||||
return;
|
||||
|
@ -2296,9 +2304,14 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state, const char *l
|
|||
* PBX wants us to dial ...
|
||||
*/
|
||||
#ifdef CC_AST_HAS_REQUEST_REQUESTOR
|
||||
#ifdef CC_AST_HAS_REQUEST_FORMAT_T
|
||||
static struct ast_channel *
|
||||
pbx_capi_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||
/* TODO: new field requestor to link to called channel */
|
||||
#else
|
||||
static struct ast_channel *
|
||||
pbx_capi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
||||
/* TODO: new field requestor to link to called channel */
|
||||
#endif
|
||||
#else
|
||||
static struct ast_channel *
|
||||
pbx_capi_request(const char *type, int format, void *data, int *cause)
|
||||
|
@ -2881,7 +2894,8 @@ static void clear_channel_fax_loop(struct ast_channel *c, struct capi_pvt *i)
|
|||
i->vname);
|
||||
break;
|
||||
}
|
||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
|
||||
if ((f->frametype == AST_FRAME_CONTROL) &&
|
||||
(FRAME_SUBCLASS_INTEGER(f->subclass) == AST_CONTROL_HANGUP)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: clear channel fax: hangup frame.\n",
|
||||
i->vname);
|
||||
ast_frfree(f);
|
||||
|
@ -2896,7 +2910,7 @@ static void clear_channel_fax_loop(struct ast_channel *c, struct capi_pvt *i)
|
|||
i->vname);
|
||||
} else {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: cler channel fax: unhandled frame %d/%d.\n",
|
||||
i->vname, f->frametype, f->subclass);
|
||||
i->vname, f->frametype, FRAME_SUBCLASS_INTEGER(f->subclass));
|
||||
}
|
||||
ast_frfree(f);
|
||||
} else if (ready_fd == i->readerfd) {
|
||||
|
@ -3545,7 +3559,7 @@ static void capidev_handle_did_digits(_cmsg *CMSG, unsigned int PLCI, unsigned i
|
|||
/* we are already in pbx, so we send the digits as dtmf */
|
||||
for (a = 0; a < strlen(did); a++) {
|
||||
fr.frametype = AST_FRAME_DTMF;
|
||||
fr.subclass = did[a];
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = did[a];
|
||||
local_queue_frame(i, &fr);
|
||||
}
|
||||
}
|
||||
|
@ -3561,16 +3575,19 @@ static void capidev_handle_did_digits(_cmsg *CMSG, unsigned int PLCI, unsigned i
|
|||
*/
|
||||
void capi_queue_cause_control(struct capi_pvt *i, int control)
|
||||
{
|
||||
struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, };
|
||||
struct ast_frame fr;
|
||||
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_HANGUP;
|
||||
|
||||
if ((i->owner) && (control)) {
|
||||
int cause = i->owner->hangupcause;
|
||||
if (cause == AST_CAUSE_NORMAL_CIRCUIT_CONGESTION) {
|
||||
fr.subclass = AST_CONTROL_CONGESTION;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_CONGESTION;
|
||||
} else if ((cause != AST_CAUSE_NO_USER_RESPONSE) &&
|
||||
(cause != AST_CAUSE_NO_ANSWER)) {
|
||||
/* not NOANSWER */
|
||||
fr.subclass = AST_CONTROL_BUSY;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_BUSY;
|
||||
}
|
||||
}
|
||||
local_queue_frame(i, &fr);
|
||||
|
@ -3873,7 +3890,7 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig
|
|||
i->vname);
|
||||
send_progress(i);
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
fr.subclass = AST_CONTROL_RINGING;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_RINGING;
|
||||
local_queue_frame(i, &fr);
|
||||
if (i->owner)
|
||||
ast_setstate(i->owner, AST_STATE_RINGING);
|
||||
|
@ -3883,7 +3900,7 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig
|
|||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: info element CALL PROCEEDING\n",
|
||||
i->vname);
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
fr.subclass = AST_CONTROL_PROCEEDING;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_PROCEEDING;
|
||||
local_queue_frame(i, &fr);
|
||||
break;
|
||||
case 0x8003: /* PROGRESS */
|
||||
|
@ -4135,7 +4152,7 @@ static int handle_facility_indication_dtmf(
|
|||
|
||||
while (i->special_tone_extension[n] != 0) {
|
||||
fr.frametype = AST_FRAME_DTMF;
|
||||
fr.subclass = i->special_tone_extension[n++];
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = i->special_tone_extension[n++];
|
||||
local_queue_frame(i, &fr);
|
||||
}
|
||||
}
|
||||
|
@ -4146,7 +4163,7 @@ static int handle_facility_indication_dtmf(
|
|||
if (ignore_digit == 0) {
|
||||
if (pbx_capi_voicecommand_process_digit(i, 0, dtmf) == 0) {
|
||||
fr.frametype = AST_FRAME_DTMF;
|
||||
fr.subclass = dtmf;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = dtmf;
|
||||
local_queue_frame(i, &fr);
|
||||
}
|
||||
}
|
||||
|
@ -4229,7 +4246,7 @@ static void capidev_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, un
|
|||
}
|
||||
#ifndef CC_AST_HAS_VERSION_1_4
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
fr.subclass = AST_CONTROL_PROGRESS;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_PROGRESS;
|
||||
local_queue_frame(i, &fr);
|
||||
#endif
|
||||
return;
|
||||
|
@ -4289,9 +4306,9 @@ static void capidev_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, un
|
|||
}
|
||||
}
|
||||
}
|
||||
fr.subclass = capi_capability;
|
||||
FRAME_SUBCLASS_CODEC(fr.subclass) = capi_capability;
|
||||
} else {
|
||||
fr.subclass = i->codec;
|
||||
FRAME_SUBCLASS_CODEC(fr.subclass) = i->codec;
|
||||
}
|
||||
|
||||
fr.frametype = AST_FRAME_VOICE;
|
||||
|
@ -4302,8 +4319,8 @@ static void capidev_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, un
|
|||
fr.mallocd = 0;
|
||||
fr.delivery = ast_tv(0,0);
|
||||
fr.src = NULL;
|
||||
cc_verbose(8, 1, VERBOSE_PREFIX_3 "%s: DATA_B3_IND (len=%d) fr.datalen=%d fr.subclass=%d\n",
|
||||
i->vname, b3len, fr.datalen, fr.subclass);
|
||||
cc_verbose(8, 1, VERBOSE_PREFIX_3 "%s: DATA_B3_IND (len=%d) fr.datalen=%d fr.subclass=%ld\n",
|
||||
i->vname, b3len, fr.datalen, FRAME_SUBCLASS_CODEC(fr.subclass));
|
||||
local_queue_frame(i, &fr);
|
||||
return;
|
||||
}
|
||||
|
@ -4313,7 +4330,10 @@ static void capidev_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, un
|
|||
*/
|
||||
static void capi_signal_answer(struct capi_pvt *i)
|
||||
{
|
||||
struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER, };
|
||||
struct ast_frame fr;
|
||||
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_ANSWER;
|
||||
|
||||
if (i->outgoing == 1) {
|
||||
local_queue_frame(i, &fr);
|
||||
|
@ -4602,9 +4622,12 @@ static void capidev_handle_connect_b3_indication(_cmsg *CMSG, unsigned int PLCI,
|
|||
*/
|
||||
static void capidev_handle_disconnect_indication(_cmsg *CMSG, unsigned int PLCI, unsigned int NCCI, struct capi_pvt *i)
|
||||
{
|
||||
struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, };
|
||||
struct ast_frame fr;
|
||||
int state;
|
||||
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_HANGUP;
|
||||
|
||||
capi_sendf(NULL, 0, CAPI_DISCONNECT_RESP, PLCI, HEADER_MSGNUM(CMSG), "");
|
||||
|
||||
show_capi_info(i, DISCONNECT_IND_REASON(CMSG));
|
||||
|
@ -4651,7 +4674,7 @@ static void capidev_handle_disconnect_indication(_cmsg *CMSG, unsigned int PLCI,
|
|||
}
|
||||
|
||||
if (DISCONNECT_IND_REASON(CMSG) == 0x34a2) {
|
||||
fr.subclass = AST_CONTROL_CONGESTION;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_CONGESTION;
|
||||
}
|
||||
|
||||
if (state == CAPI_STATE_DISCONNECTING) {
|
||||
|
@ -5022,7 +5045,10 @@ void capidev_handle_connection_conf(struct capi_pvt **i, unsigned int PLCI,
|
|||
unsigned short wInfo, unsigned short wMsgNum)
|
||||
{
|
||||
struct capi_pvt *ii;
|
||||
struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_BUSY, };
|
||||
struct ast_frame fr;
|
||||
|
||||
fr.frametype = AST_FRAME_CONTROL;
|
||||
FRAME_SUBCLASS_INTEGER(fr.subclass) = AST_CONTROL_BUSY;
|
||||
|
||||
if (*i) {
|
||||
cc_log(LOG_ERROR, CC_MESSAGE_BIGNAME ": CONNECT_CONF for already "
|
||||
|
|
28
chan_capi.h
28
chan_capi.h
|
@ -31,7 +31,11 @@
|
|||
#include <asterisk/features.h>
|
||||
#include <asterisk/utils.h>
|
||||
#include <asterisk/cli.h>
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
#include <asterisk/rtp_engine.h>
|
||||
#else
|
||||
#include <asterisk/rtp.h>
|
||||
#endif
|
||||
#include <asterisk/causes.h>
|
||||
#include <asterisk/strings.h>
|
||||
#include <asterisk/dsp.h>
|
||||
|
@ -126,6 +130,14 @@ static inline unsigned int read_capi_dword(void *m)
|
|||
#define FRAME_DATA_PTR data
|
||||
#endif
|
||||
|
||||
#ifdef CC_AST_HAS_UNION_SUBCLASS_IN_FRAME
|
||||
#define FRAME_SUBCLASS_INTEGER(x) x.integer
|
||||
#define FRAME_SUBCLASS_CODEC(x) x.codec
|
||||
#else
|
||||
#define FRAME_SUBCLASS_INTEGER(x) x
|
||||
#define FRAME_SUBCLASS_CODEC(x) x
|
||||
#endif
|
||||
|
||||
#ifndef CC_AST_HAS_CHANNEL_RELEASE
|
||||
#define ast_channel_release(x) ast_channel_free(x)
|
||||
#endif
|
||||
|
@ -496,8 +508,16 @@ struct capi_pvt {
|
|||
time_t whentoretrieve;
|
||||
|
||||
/* RTP */
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
struct ast_rtp_instance *rtp;
|
||||
#else
|
||||
struct ast_rtp *rtp;
|
||||
#endif
|
||||
#ifdef CC_AST_HAS_FORMAT_T
|
||||
format_t capability;
|
||||
#else
|
||||
int capability;
|
||||
#endif
|
||||
int rtpcodec;
|
||||
int codec;
|
||||
unsigned int timestamp;
|
||||
|
@ -570,7 +590,11 @@ struct cc_capi_conf {
|
|||
float rxgain;
|
||||
float txgain;
|
||||
struct ast_codec_pref prefs;
|
||||
#ifdef CC_AST_HAS_FORMAT_T
|
||||
format_t capability;
|
||||
#else
|
||||
int capability;
|
||||
#endif
|
||||
#ifdef CC_AST_HAS_VERSION_1_4
|
||||
struct ast_jb_conf jbconf;
|
||||
char mohinterpret[MAX_MUSICCLASS];
|
||||
|
@ -666,7 +690,11 @@ struct cc_capi_controller {
|
|||
* prototypes
|
||||
*/
|
||||
extern const struct ast_channel_tech capi_tech;
|
||||
#ifdef CC_AST_HAS_FORMAT_T
|
||||
extern format_t capi_capability;
|
||||
#else
|
||||
extern int capi_capability;
|
||||
#endif
|
||||
extern unsigned capi_ApplID;
|
||||
extern struct capi_pvt *capi_iflist;
|
||||
extern void cc_start_b3(struct capi_pvt *i);
|
||||
|
|
|
@ -484,7 +484,8 @@ static void chat_handle_events(struct ast_channel *c, struct capi_pvt *i,
|
|||
i->vname);
|
||||
break;
|
||||
}
|
||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
|
||||
if ((f->frametype == AST_FRAME_CONTROL) &&
|
||||
(FRAME_SUBCLASS_INTEGER(f->subclass) == AST_CONTROL_HANGUP)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: chat: hangup frame.\n",
|
||||
i->vname);
|
||||
ast_frfree(f);
|
||||
|
@ -502,10 +503,10 @@ static void chat_handle_events(struct ast_channel *c, struct capi_pvt *i,
|
|||
cc_verbose(5, 1, VERBOSE_PREFIX_3 "%s: chat: NULL frame, ignoring.\n",
|
||||
i->vname);
|
||||
} else if ((f->frametype == AST_FRAME_DTMF_END) && (voice_message == NULL)) {
|
||||
pbx_capi_voicecommand_process_digit (i, c, f->subclass);
|
||||
pbx_capi_voicecommand_process_digit(i, c, FRAME_SUBCLASS_INTEGER(f->subclass));
|
||||
} else {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: chat: unhandled frame %d/%d.\n",
|
||||
i->vname, f->frametype, f->subclass);
|
||||
i->vname, f->frametype, FRAME_SUBCLASS_INTEGER(f->subclass));
|
||||
}
|
||||
ast_frfree(f);
|
||||
} else if (ready_fd == i->readerfd) {
|
||||
|
|
|
@ -166,12 +166,23 @@ int capi_alloc_rtp(struct capi_pvt *i)
|
|||
hp = ast_gethostbyname("localhost", &ahp);
|
||||
memcpy(&addr, hp->h_addr, sizeof(addr));
|
||||
|
||||
if (!(i->rtp = ast_rtp_new_with_bindaddr(NULL, NULL, 0, 0, addr))) {
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
i->rtp = ast_rtp_instance_new(NULL, NULL, (struct sockaddr_in *)&addr, NULL);
|
||||
#else
|
||||
i->rtp = ast_rtp_new_with_bindaddr(NULL, NULL, 0, 0, addr);
|
||||
#endif
|
||||
|
||||
if (!(i->rtp)) {
|
||||
cc_log(LOG_ERROR, "%s: unable to alloc rtp.\n", i->vname);
|
||||
return 1;
|
||||
}
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
ast_rtp_instance_get_local_address(i->rtp, &us);
|
||||
ast_rtp_instance_set_remote_address(i->rtp, &us);
|
||||
#else
|
||||
ast_rtp_get_us(i->rtp, &us);
|
||||
ast_rtp_set_peer(i->rtp, &us);
|
||||
#endif
|
||||
cc_verbose(2, 1, VERBOSE_PREFIX_4 "%s: alloc rtp socket on %s:%d\n",
|
||||
i->vname,
|
||||
#ifdef CC_AST_HAS_VERSION_1_4
|
||||
|
@ -202,17 +213,28 @@ int capi_write_rtp(struct capi_pvt *i, struct ast_frame *f)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
ast_rtp_instance_get_local_address(i->rtp, &us);
|
||||
ast_rtp_instance_set_remote_address(i->rtp, &us);
|
||||
if (ast_rtp_instance_write(i->rtp, f) != 0) {
|
||||
#else
|
||||
ast_rtp_get_us(i->rtp, &us);
|
||||
ast_rtp_set_peer(i->rtp, &us);
|
||||
if (ast_rtp_write(i->rtp, f) != 0) {
|
||||
#endif
|
||||
cc_verbose(3, 0, VERBOSE_PREFIX_2 "%s: rtp_write error, dropping packet.\n",
|
||||
i->vname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
len = recvfrom(ast_rtp_fd(i->rtp), buf, sizeof(buf),
|
||||
0, (struct sockaddr *)&us, &uslen);
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
len = recvfrom(ast_rtp_instance_fd(i->rtp, 0),
|
||||
buf, sizeof(buf), 0, (struct sockaddr *)&us, &uslen);
|
||||
#else
|
||||
len = recvfrom(ast_rtp_fd(i->rtp),
|
||||
buf, sizeof(buf), 0, (struct sockaddr *)&us, &uslen);
|
||||
#endif
|
||||
if (len <= 0)
|
||||
break;
|
||||
|
||||
|
@ -238,7 +260,7 @@ int capi_write_rtp(struct capi_pvt *i, struct ast_frame *f)
|
|||
i->send_buffer_handle++;
|
||||
|
||||
cc_verbose(6, 1, VERBOSE_PREFIX_4 "%s: RTP write for NCCI=%#x len=%d(%d) %s ts=%x\n",
|
||||
i->vname, i->NCCI, len, f->datalen, ast_getformatname(f->subclass),
|
||||
i->vname, i->NCCI, len, f->datalen, ast_getformatname(FRAME_SUBCLASS_CODEC(f->subclass)),
|
||||
i->timestamp);
|
||||
|
||||
capi_sendf(NULL, 0, CAPI_DATA_B3_REQ, i->NCCI, get_capi_MessageNumber(),
|
||||
|
@ -269,28 +291,42 @@ struct ast_frame *capi_read_rtp(struct capi_pvt *i, unsigned char *buf, int len)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
ast_rtp_instance_get_local_address(i->rtp, &us);
|
||||
ast_rtp_instance_set_remote_address(i->rtp, &us);
|
||||
#else
|
||||
ast_rtp_get_us(i->rtp, &us);
|
||||
ast_rtp_set_peer(i->rtp, &us);
|
||||
#endif
|
||||
|
||||
if (len != sendto(ast_rtp_fd(i->rtp), buf, len, 0, (struct sockaddr *)&us, sizeof(us))) {
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
if (len != sendto(ast_rtp_instance_fd(i->rtp, 0), buf, len, 0, (struct sockaddr *)&us, sizeof(us)))
|
||||
#else
|
||||
if (len != sendto(ast_rtp_fd(i->rtp), buf, len, 0, (struct sockaddr *)&us, sizeof(us)))
|
||||
#endif
|
||||
{
|
||||
cc_verbose(4, 1, VERBOSE_PREFIX_3 "%s: RTP sendto error\n",
|
||||
i->vname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CC_AST_HAS_RTP_ENGINE_H
|
||||
if ((f = ast_rtp_instance_read(i->rtp, 0))) {
|
||||
#else
|
||||
if ((f = ast_rtp_read(i->rtp))) {
|
||||
#endif
|
||||
if (f->frametype != AST_FRAME_VOICE) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: DATA_B3_IND RTP (len=%d) non voice type=%d\n",
|
||||
i->vname, len, f->frametype);
|
||||
return NULL;
|
||||
}
|
||||
cc_verbose(6, 1, VERBOSE_PREFIX_4 "%s: DATA_B3_IND RTP NCCI=%#x len=%d %s (read/write=%d/%d)\n",
|
||||
i->vname, i->NCCI, len, ast_getformatname(f->subclass),
|
||||
i->vname, i->NCCI, len, ast_getformatname(FRAME_SUBCLASS_CODEC(f->subclass)),
|
||||
i->owner->readformat, i->owner->writeformat);
|
||||
if (i->owner->nativeformats != f->subclass) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: DATA_B3_IND RTP nativeformats=%d, but subclass=%d\n",
|
||||
i->vname, i->owner->nativeformats, f->subclass);
|
||||
i->owner->nativeformats = f->subclass;
|
||||
if (i->owner->nativeformats != FRAME_SUBCLASS_CODEC(f->subclass)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: DATA_B3_IND RTP nativeformats=%d, but subclass=%ld\n",
|
||||
i->vname, i->owner->nativeformats, FRAME_SUBCLASS_CODEC(f->subclass));
|
||||
i->owner->nativeformats = FRAME_SUBCLASS_CODEC(f->subclass);
|
||||
ast_set_read_format(i->owner, i->owner->readformat);
|
||||
ast_set_write_format(i->owner, i->owner->writeformat);
|
||||
}
|
||||
|
|
|
@ -1297,7 +1297,7 @@ struct ast_frame *capi_read_pipeframe(struct capi_pvt *i)
|
|||
|
||||
f = &i->f;
|
||||
f->frametype = AST_FRAME_NULL;
|
||||
f->subclass = 0;
|
||||
FRAME_SUBCLASS_INTEGER(f->subclass) = 0;
|
||||
|
||||
readsize = read(i->readerfd, f, sizeof(struct ast_frame));
|
||||
if ((readsize != sizeof(struct ast_frame)) && (readsize > 0)) {
|
||||
|
@ -1308,7 +1308,8 @@ struct ast_frame *capi_read_pipeframe(struct capi_pvt *i)
|
|||
f->mallocd = 0;
|
||||
f->FRAME_DATA_PTR = NULL;
|
||||
|
||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
|
||||
if ((f->frametype == AST_FRAME_CONTROL) &&
|
||||
(FRAME_SUBCLASS_INTEGER(f->subclass) == AST_CONTROL_HANGUP)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1385,10 +1386,11 @@ int capi_write_frame(struct capi_pvt *i, struct ast_frame *f)
|
|||
return 0;
|
||||
}
|
||||
if (i->isdnstate & CAPI_ISDN_STATE_RTP) {
|
||||
if (unlikely((!(f->subclass & i->codec)) &&
|
||||
(f->subclass != capi_capability))) {
|
||||
if (unlikely((!(FRAME_SUBCLASS_CODEC(f->subclass) & i->codec)) &&
|
||||
(FRAME_SUBCLASS_CODEC(f->subclass) != capi_capability))) {
|
||||
cc_log(LOG_ERROR, "don't know how to write subclass %s(%d)\n",
|
||||
ast_getformatname(f->subclass), f->subclass);
|
||||
ast_getformatname(FRAME_SUBCLASS_CODEC(f->subclass)),
|
||||
FRAME_SUBCLASS_INTEGER(f->subclass));
|
||||
return 0;
|
||||
}
|
||||
return capi_write_rtp(i, f);
|
||||
|
|
|
@ -34,6 +34,11 @@ if [ "$AVERSION" = "" ]; then
|
|||
AVERSION="trunk"
|
||||
VER="1_6"
|
||||
fi
|
||||
if [ -z "$AVERSIONNUM" ]; then
|
||||
AVERSIONNUM=999999
|
||||
AVERSION="trunk"
|
||||
VER="1_6"
|
||||
fi
|
||||
echo $AVERSION
|
||||
|
||||
echo "/*" >$CONFIGFILE
|
||||
|
@ -163,6 +168,13 @@ check_version_onesix()
|
|||
echo "#undef CC_AST_HAS_UNION_DATA_IN_FRAME" >>$CONFIGFILE
|
||||
echo " * no new union data in ast_frame structure"
|
||||
fi
|
||||
if grep -q "} subclass;" $INCLUDEDIR/frame.h; then
|
||||
echo "#define CC_AST_HAS_UNION_SUBCLASS_IN_FRAME" >>$CONFIGFILE
|
||||
echo " * found new union subclass in ast_frame structure"
|
||||
else
|
||||
echo "#undef CC_AST_HAS_UNION_SUBCLASS_IN_FRAME" >>$CONFIGFILE
|
||||
echo " * no new union subclass in ast_frame structure"
|
||||
fi
|
||||
if grep -q "ast_channel_release.*struct" $INCLUDEDIR/channel.h; then
|
||||
echo "#define CC_AST_HAS_CHANNEL_RELEASE" >>$CONFIGFILE
|
||||
echo " * found ast_channel_release function"
|
||||
|
@ -184,6 +196,13 @@ check_version_onesix()
|
|||
echo "#undef CC_AST_HAS_REQUEST_REQUESTOR" >>$CONFIGFILE
|
||||
echo " * no requestor in ast_request"
|
||||
fi
|
||||
if grep -q "ast_request.*format_t format" $INCLUDEDIR/channel.h; then
|
||||
echo "#define CC_AST_HAS_REQUEST_FORMAT_T" >>$CONFIGFILE
|
||||
echo " * found format_t in ast_request"
|
||||
else
|
||||
echo "#undef CC_AST_HAS_REQUEST_FORMAT_T" >>$CONFIGFILE
|
||||
echo " * no format_t in ast_request"
|
||||
fi
|
||||
if grep -q "ast_register_application2.*void " $INCLUDEDIR/module.h; then
|
||||
echo "#undef CC_AST_HAS_CONST_CHAR_IN_REGAPPL" >>$CONFIGFILE
|
||||
echo " * no const char in ast_register_application"
|
||||
|
@ -198,6 +217,24 @@ check_version_onesix()
|
|||
echo "#undef CC_AST_HAS_LINKEDID_CHAN_ALLOC" >>$CONFIGFILE
|
||||
echo " * no linkedid in ast_channel_alloc"
|
||||
fi
|
||||
if [ -f $INCLUDEDIR/frame_defs.h ]; then
|
||||
if grep -q "typedef.*format_t" $INCLUDEDIR/frame_defs.h; then
|
||||
echo "#define CC_AST_HAS_FORMAT_T" >>$CONFIGFILE
|
||||
echo " * found format_t in frame_defs"
|
||||
else
|
||||
echo "#undef CC_AST_HAS_FORMAT_T" >>$CONFIGFILE
|
||||
echo " * no format_t in frame_defs"
|
||||
fi
|
||||
else
|
||||
echo "#undef CC_AST_HAS_FORMAT_T" >>$CONFIGFILE
|
||||
fi
|
||||
if [ -f $INCLUDEDIR/rtp_engine.h ]; then
|
||||
echo "#define CC_AST_HAS_RTP_ENGINE_H" >>$CONFIGFILE
|
||||
echo " * found rtp_engine.h"
|
||||
else
|
||||
echo "#undef CC_AST_HAS_RTP_ENGINE_H" >>$CONFIGFILE
|
||||
echo " * no rtp_engine.h"
|
||||
fi
|
||||
}
|
||||
|
||||
case $VER in
|
||||
|
|
Loading…
Reference in New Issue