summaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-09-14 01:35:43 +0200
committerPatrick McHardy <kaber@trash.net>2010-09-17 17:42:35 +0200
commitd9330a5866ba06f3681edc810befd2f526d7ff06 (patch)
treec4df989d17a15833598e4c5934e006407c1d07ba /example
parent62fb24bb7a8579b222d02024df238edce2331822 (diff)
example: fix fp-cc segfault
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'example')
-rw-r--r--example/fp-cc.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/example/fp-cc.c b/example/fp-cc.c
index e29cfa5..daaab80 100644
--- a/example/fp-cc.c
+++ b/example/fp-cc.c
@@ -40,34 +40,37 @@ static void dect_keypad_complete(struct dect_handle *dh, void *call,
printf("keypad complete: '%.*s'\n", keypad->len, keypad->info);
}
+static void dect_call_init(struct dect_handle *dh, struct dect_call *call)
+{
+ struct call *priv = dect_call_priv(call);
+
+ priv->timer = dect_timer_alloc(dh);
+ priv->keybuf = dect_keypad_buffer_init(dh, 3, dect_keypad_complete, call);
+ priv->audio = dect_audio_open();
+}
+
static void dect_mncc_connect_ind(struct dect_handle *dh, struct dect_call *call,
struct dect_mncc_connect_param *param)
{
+ struct dect_mncc_connect_param reply = {};
+
+ dect_mncc_connect_res(dh, call, &reply);
}
static void dect_mncc_setup_ind(struct dect_handle *dh, struct dect_call *call,
struct dect_mncc_setup_param *setup)
{
- struct call *priv = dect_call_priv(call);
struct dect_ie_signal signal;
struct dect_mncc_connect_param connect = {
//.signal = &signal,
};
- signal.code = DECT_SIGNAL_DIAL_TONE_ON;
-
- priv->timer = dect_timer_alloc(dh);
- priv->keybuf = dect_keypad_buffer_init(dh, 3, dect_keypad_complete, call);
- priv->audio = dect_audio_open();
+ dect_call_init(dh, call);
+ signal.code = DECT_SIGNAL_DIAL_TONE_ON;
dect_mncc_connect_req(dh, call, &connect);
}
-static void dect_mncc_setup_ack_ind(struct dect_handle *dh, struct dect_call *call,
- struct dect_mncc_setup_ack_param *param)
-{
-}
-
static void dect_mncc_info_ind(struct dect_handle *dh, struct dect_call *call,
struct dect_mncc_info_param *param)
{
@@ -174,12 +177,11 @@ static void dect_open_call(struct dect_handle *dh, const struct dect_ipui *ipui)
.basic_service = &basic_service,
};
struct dect_call *call;
- struct call *priv;
call = dect_call_alloc(dh);
if (call == NULL)
return;
- priv = dect_call_priv(call);
+ dect_call_init(dh, call);
basic_service.class = DECT_CALL_CLASS_NORMAL;
basic_service.service = DECT_SERVICE_BASIC_SPEECH_DEFAULT;
@@ -193,14 +195,14 @@ static void dect_dl_u_data_ind(struct dect_handle *dh, struct dect_call *call,
struct call *priv = dect_call_priv(call);
dect_dl_u_data_req(dh, call, mb);
- dect_audio_queue(priv->audio, mb);
+ if (priv->audio != NULL)
+ dect_audio_queue(priv->audio, mb);
}
static struct dect_cc_ops cc_ops = {
.priv_size = sizeof(struct call),
.mncc_connect_ind = dect_mncc_connect_ind,
.mncc_setup_ind = dect_mncc_setup_ind,
- .mncc_setup_ack_ind = dect_mncc_setup_ack_ind,
.mncc_info_ind = dect_mncc_info_ind,
.mncc_alert_ind = dect_mncc_alert_ind,
.mncc_reject_ind = dect_mncc_reject_ind,