提交 fb4a8b2a authored 作者: Michael Jerris's avatar Michael Jerris

change outbound req code for isdn

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@471 a93c3328-9c30-0410-af19-c9cd2b2d52af
上级 f99afcef
......@@ -313,6 +313,12 @@ typedef struct {
uint8_t plan;
} zap_number_t;
typedef enum {
ZAP_CALLER_STATE_DIALING,
ZAP_CALLER_STATE_SUCCESS,
ZAP_CALLER_STATE_FAIL
} zap_caller_state_t;
struct zap_caller_data {
char cid_date[8];
char cid_name[80];
......@@ -328,6 +334,9 @@ struct zap_caller_data {
int hangup_cause;
uint8_t raw_data[1024];
uint32_t raw_data_len;
uint32_t flags;
zap_caller_state_t call_state;
uint32_t chan_id;
};
typedef enum {
......@@ -410,6 +419,7 @@ struct zap_isdn_data {
struct zap_sigmsg sigmsg;
zio_signal_cb_t sig_cb;
uint32_t flags;
zap_caller_data_t *outbound_crv[32768];
zap_channel_t *channels_local_crv[32768];
zap_channel_t *channels_remote_crv[32768];
};
......@@ -444,6 +454,7 @@ struct zap_span {
zio_channel_request_t channel_request;
void *mod_data;
char *type;
int suggest_chan_id;
};
......@@ -520,7 +531,7 @@ zap_status_t zap_span_set_event_callback(zap_span_t *span, zio_event_cb_t event_
zap_status_t zap_channel_set_event_callback(zap_channel_t *zchan, zio_event_cb_t event_callback);
zap_status_t zap_channel_open(uint32_t span_id, uint32_t chan_id, zap_channel_t **zchan);
zap_status_t zap_channel_open_chan(zap_channel_t *zchan);
zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, const zap_caller_data_t *caller_data, zap_channel_t **zchan);
zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, zap_caller_data_t *caller_data, zap_channel_t **zchan);
zap_status_t zap_channel_close(zap_channel_t **zchan);
zap_status_t zap_channel_done(zap_channel_t *zchan);
zap_status_t zap_channel_use(zap_channel_t *zchan);
......
......@@ -349,7 +349,7 @@ typedef struct zap_sigmsg zap_sigmsg_t;
typedef struct zap_span zap_span_t;
typedef struct zap_caller_data zap_caller_data_t;
#define ZIO_CHANNEL_REQUEST_ARGS (zap_span_t *span, zap_direction_t direction, const zap_caller_data_t *caller_data, zap_channel_t **zchan)
#define ZIO_CHANNEL_REQUEST_ARGS (zap_span_t *span, uint32_t chan_id, zap_direction_t direction, zap_caller_data_t *caller_data, zap_channel_t **zchan)
#define ZIO_CHANNEL_OUTGOING_CALL_ARGS (zap_channel_t *zchan)
#define ZIO_SPAN_POLL_EVENT_ARGS (zap_span_t *span, uint32_t ms)
#define ZIO_SPAN_NEXT_EVENT_ARGS (zap_span_t *span, zap_event_t **event)
......
......@@ -709,7 +709,7 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
return ok ? ZAP_SUCCESS : ZAP_FAIL;
}
zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, const zap_caller_data_t *caller_data, zap_channel_t **zchan)
zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, zap_caller_data_t *caller_data, zap_channel_t **zchan)
{
zap_status_t status = ZAP_FAIL;
zap_channel_t *check;
......@@ -723,9 +723,9 @@ zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, c
*zchan = NULL;
return ZAP_FAIL;
}
if (globals.spans[span_id].channel_request) {
return globals.spans[span_id].channel_request(&globals.spans[span_id], direction, caller_data, zchan);
if (globals.spans[span_id].channel_request && !globals.spans[span_id].suggest_chan_id) {
return globals.spans[span_id].channel_request(&globals.spans[span_id], 0, direction, caller_data, zchan);
}
span_max = span_id;
......@@ -783,6 +783,12 @@ zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, c
check->state == ZAP_CHANNEL_STATE_DOWN
) {
if (globals.spans[span_id].channel_request) {
status = globals.spans[span_id].channel_request(&globals.spans[span_id], i, direction, caller_data, zchan);
zap_mutex_unlock(span->mutex);
goto done;
}
status = check->zio->open(check);
if (status == ZAP_SUCCESS) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论