~ubuntu-branches/ubuntu/quantal/linphone/quantal

« back to all changes in this revision

Viewing changes to coreapi/osipuacb.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-11-15 10:34:50 UTC
  • mfrom: (1.2.1 upstream) (2.1.8 feisty)
  • Revision ID: james.westby@ubuntu.com-20061115103450-qgafwcks2lkhctlj
* New upstream release.
* Enable video support.
* Fix mismatched #endif in mscommon.h, closes: #398307.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
linphone
3
 
Copyright (C) 2000  Simon MORLAT (simon.morlat@free.fr)
4
 
 
5
 
This program is free software; you can redistribute it and/or
6
 
modify it under the terms of the GNU General Public License
7
 
as published by the Free Software Foundation; either version 2
8
 
of the License, or (at your option) any later version.
9
 
 
10
 
This program is distributed in the hope that it will be useful,
11
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
GNU General Public License for more details.
14
 
 
15
 
You should have received a copy of the GNU General Public License
16
 
along with this program; if not, write to the Free Software
17
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
*/
19
 
 
20
 
#include "osipuacb.h"
21
 
#include "linphonecore.h"
22
 
#include "misc.h"
23
 
 
24
 
/* these are useful messages for the status */
25
 
extern gchar *ready;
26
 
extern gchar *end;
27
 
extern gchar *contacting;
28
 
extern gchar *connected;
29
 
extern gchar *cancel;
30
 
extern gchar *contacted;
31
 
 
32
 
int invite_accepted_cb(OsipDialog *dialog, transaction_t *trn, sip_t *sipmsg, void *data)
33
 
{
34
 
        OsipUA *ua=osip_dialog_get_ua(dialog);
35
 
        LinphoneCore *lc=(LinphoneCore*)ua->data;
36
 
        gint jitt_comp;
37
 
        gint err;
38
 
        LinphoneDialogParams *diaparams=(LinphoneDialogParams *)lc->call->data;
39
 
        StreamParams *audio_params=&diaparams->audio_params;
40
 
 
41
 
        linphone_core_thread_enter(lc); 
42
 
        lc->vtable.show(lc);
43
 
        lc->vtable.display_status(lc,connected);
44
 
        
45
 
        if (lc->ringstream!=NULL){
46
 
                ring_stop(lc->ringstream);
47
 
                lc->ringstream=NULL;
48
 
        }else err=try_open_dsp(lc);
49
 
        
50
 
        if (err>0){
51
 
                /* adjust rtp jitter compensation. It must be at least the latency of the sound card */
52
 
                jitt_comp=MAX(lc->sound_conf.latency,lc->rtp_conf.audio_jitt_comp);
53
 
                lc->audiostream=audio_stream_start_with_sndcard(diaparams->profile,audio_params->localport,
54
 
                                        audio_params->remoteaddr,audio_params->remoteport,
55
 
                                        audio_params->pt,jitt_comp,lc->sound_conf.sndcard);
56
 
        }
57
 
        
58
 
        linphone_core_thread_leave(lc); 
59
 
        return 0;
60
 
}
61
 
 
62
 
 
63
 
int bye_cb(OsipDialog *dialog, transaction_t *trn, sip_t *msg, void *p2)
64
 
{
65
 
        OsipUA *ua=osip_dialog_get_ua(dialog);
66
 
        LinphoneCore *lc=(LinphoneCore*)ua->data;
67
 
        LinphoneDialogParams *diaparams;
68
 
        
69
 
        linphone_core_thread_enter(lc); 
70
 
        linphone_core_lock(lc);
71
 
        
72
 
        diaparams=(LinphoneDialogParams*)dialog->data;
73
 
        
74
 
        /*stop ringing if necessary*/
75
 
        if (lc->ringstream!=NULL) {
76
 
                ring_stop(lc->ringstream);
77
 
                lc->ringstream=NULL;
78
 
        }
79
 
        if (lc->audiostream!=NULL) {
80
 
                audio_stream_stop(lc->audiostream);
81
 
                lc->audiostream=NULL;
82
 
        }
83
 
        lc->vtable.show(lc);
84
 
        lc->vtable.display_status(lc,end);
85
 
        
86
 
        lc->call=NULL;
87
 
        if (diaparams!=NULL) linphone_dialog_params_destroy(diaparams);
88
 
        restore_sound_daemons();
89
 
        linphone_core_thread_leave(lc); 
90
 
        linphone_core_unlock(lc);
91
 
        return 0;
92
 
}
93
 
 
94
 
int faillure_cb(OsipDialog *dialog, transaction_t *trn, sip_t *msg, void *p2)
95
 
{
96
 
        int err=((int*)p2)[0];
97
 
        char *reason;
98
 
        header_t *retry;
99
 
        char *umsg;
100
 
        char *msg486=_("User is busy.");
101
 
        char *msg480=_("User is temporarily unavaillable.");
102
 
        char *retrymsg=_("%s. Retry after %i minute(s).");
103
 
        char *msg600=_("User does not want to be disturbed.");
104
 
        char *msg603=_("Call declined.");
105
 
        char* tmpmsg=msg486;
106
 
        OsipUA *ua=osip_dialog_get_ua(dialog);
107
 
        LinphoneCore *lc=(LinphoneCore*)ua->data;
108
 
        LinphoneDialogParams *diaparams;
109
 
        linphone_core_lock(lc);
110
 
        diaparams=(LinphoneDialogParams*)dialog->data;
111
 
        linphone_core_thread_enter(lc); 
112
 
        lc->vtable.show(lc);
113
 
        switch(err)
114
 
        {
115
 
                case 404:
116
 
                        lc->vtable.display_status(lc,_("User cannot be found at given address."));
117
 
                break;
118
 
                case 415:
119
 
                        lc->vtable.display_status(lc,_("Remote user cannot support any of proposed codecs."));
120
 
                break;
121
 
                case 480:
122
 
                        tmpmsg=msg480;
123
 
                case 486:
124
 
                        msg_header_getbyname(msg,"retry-after",0,&retry);
125
 
                        if (retry!=NULL)
126
 
                        {
127
 
                                umsg=g_malloc(strlen(tmpmsg)+strlen(retrymsg)+13);
128
 
                                sprintf(umsg,retrymsg,tmpmsg,atoi(retry->hvalue)/60);
129
 
                                lc->vtable.display_message(lc,umsg);
130
 
                                g_free(umsg);
131
 
                        }               
132
 
                        lc->vtable.display_message(lc,tmpmsg);
133
 
                break;
134
 
                
135
 
                case 600:
136
 
                        lc->vtable.display_message(lc,msg600);
137
 
                break;
138
 
                case 603:
139
 
                        lc->vtable.display_status(lc,msg603);
140
 
                break;
141
 
                case -110:  /* time out, call leg is lost */
142
 
                        lc->vtable.display_status(lc,_("Timeout."));
143
 
                break;
144
 
                case -111:
145
 
                        lc->vtable.display_status(lc,_("Remote host was found but refused connection."));
146
 
                break;
147
 
                
148
 
                default:
149
 
                        if (err>0)
150
 
                        {
151
 
                                reason=msg_getreason(err);
152
 
                                lc->vtable.display_status(lc,reason);
153
 
                                sfree(reason);
154
 
                        }
155
 
                        else g_message("faillure_cb: %s\n",strerror(-err));     
156
 
        }
157
 
        if (lc->ringstream!=NULL) {
158
 
                ring_stop(lc->ringstream);
159
 
                lc->ringstream=NULL;
160
 
                restore_sound_daemons();
161
 
        }
162
 
        if (diaparams!=NULL) linphone_dialog_params_destroy(diaparams);
163
 
        lc->call=NULL;
164
 
        linphone_core_thread_leave(lc); 
165
 
        linphone_core_unlock(lc);
166
 
        return 0;
167
 
}
168
 
 
169
 
int invite_cb(OsipDialog *dialog, transaction_t *trn, sip_t *sipmsg, void *p)
170
 
{
171
 
        from_t *from=sipmsg->from;
172
 
        char *barmesg,*rem_url;
173
 
        int addrlen;
174
 
        BodyContext *sdpctx;
175
 
        OsipUA *ua=osip_dialog_get_ua(dialog);
176
 
        LinphoneCore *lc=(LinphoneCore*)ua->data;
177
 
        linphone_core_lock(lc);
178
 
        linphone_core_thread_enter(lc); 
179
 
        /* first check if we can answer successfully to this invite */
180
 
        /* not busy */
181
 
        if (lc->call!=NULL){
182
 
                osip_dialog_respond(dialog,trn,486);
183
 
                goto end;
184
 
        }
185
 
        /* sdp params ok */
186
 
        sdpctx=osip_dialog_get_body_context(dialog,"application/sdp",0);
187
 
        /* get the result of the negociation */
188
 
        switch(SDP_CONTEXT(sdpctx)->negoc_status)
189
 
        {
190
 
                case -1:        
191
 
                        g_warning("Error during sdp negociation. Cannot accept incoming call.\n");
192
 
                        osip_dialog_respond(dialog,trn,606);
193
 
                break;
194
 
                case 200:
195
 
                        from_2char_without_params(from,&rem_url);
196
 
                        if (rem_url!=NULL){
197
 
                                barmesg=g_strdup_printf("%s %s.",rem_url,contacted);
198
 
                        }
199
 
                        else barmesg=g_strdup_printf("Somebody %s.",contacted);
200
 
                        
201
 
                        lc->vtable.show(lc);
202
 
                        lc->vtable.display_status(lc,barmesg);  
203
 
                        lc->vtable.inv_recv(lc,rem_url);
204
 
                        sfree(rem_url);
205
 
                        lc->call=dialog;
206
 
                                /* play the ring */
207
 
                        if (try_open_dsp(lc)>0){
208
 
                                g_message("Starting local ring...");
209
 
                                lc->ringstream=ring_start(lc->sound_conf.local_ring,2,lc->sound_conf.sndcard);
210
 
                        }
211
 
                        lc->current_trn=trn;
212
 
                        g_free(barmesg);
213
 
                break;
214
 
                default:
215
 
                        osip_dialog_respond(dialog,trn,SDP_CONTEXT(sdpctx)->negoc_status);
216
 
        }
217
 
        end:
218
 
        
219
 
        linphone_core_unlock(lc);
220
 
        linphone_core_thread_leave(lc); 
221
 
        return 0;
222
 
}
223
 
 
224
 
 
225
 
int informative_cb(OsipDialog *dialog, transaction_t *trn, sip_t *msg, void *p2)
226
 
{
227
 
        int err=((int*)p2)[0];
228
 
        contact_t *contact;
229
 
        char *ctt;
230
 
        OsipUA *ua=osip_dialog_get_ua(dialog);
231
 
        LinphoneCore *lc=(LinphoneCore*)ua->data;
232
 
        linphone_core_thread_enter(lc); 
233
 
        linphone_core_lock(lc);
234
 
        switch(err)
235
 
        {
236
 
                case 100:
237
 
                        break;
238
 
                case 180:
239
 
                        //g_message("We are in 180 switch of informative_cb()");
240
 
                        if (try_open_dsp(lc)>0)
241
 
                                lc->ringstream=ring_start(lc->sound_conf.remote_ring,2,lc->sound_conf.sndcard);
242
 
                        break;
243
 
                case 183:
244
 
                        // this is used by cisco gateways
245
 
                        break;
246
 
                case 200:   /* for the moment only REGISTER request followed by 200 OK are said to the user*/
247
 
                         if (lc->sip_conf.reg_conf.expires) lc->vtable.display_status(lc,_("Registration successfull."));
248
 
                         else  lc->vtable.display_status(lc,_("Unregistration successfull."));
249
 
                break;
250
 
                case 380:
251
 
                        msg_getcontact(msg,0,&contact);
252
 
                        if (contact!=NULL)
253
 
                        {                       
254
 
                                contact_2char(contact,&ctt);
255
 
                        }else ctt=sgetcopy(_("(No contact information !)"));
256
 
                        
257
 
                        lc->vtable.display_url(lc,_("User is not reachable at the moment but he invites you\nto contact him using the following alternate resource:"),ctt);
258
 
                        sfree(ctt);
259
 
                        lc->call=NULL;
260
 
                break;                  
261
 
                default:
262
 
                        g_warning("unsupported informative message.\n");
263
 
        }
264
 
        linphone_core_thread_leave(lc); 
265
 
        linphone_core_unlock(lc);
266
 
        return 0;
267
 
}
268
 
 
269
 
 
270
 
 
271
 
/* these are the SdpHandler callbacks: we are called in to be aware of the content
272
 
of the SDP messages exchanged */
273
 
 
274
 
int set_audio_offer(SdpHandler *sdph,SdpContext *ctx)
275
 
{
276
 
        LinphoneCore *lc;
277
 
        OsipUA *ua;
278
 
        PayloadType *codec;
279
 
        GList *elem;
280
 
        SdpPayload payload;
281
 
        ua=body_handler_get_ua(BODY_HANDLER(sdph));
282
 
        lc=(LinphoneCore*)ua->data;
283
 
        
284
 
        /* set the nat address in the SDP, if given */
285
 
        if (lc->net_conf.nat_address!=NULL && lc->net_conf.use_nat){
286
 
                sdp_t *sdp=ctx->offer;
287
 
                sfree(sdp->c_connection->c_addr);
288
 
                sdp->c_connection->c_addr=sgetcopy(lc->net_conf.nat_address);
289
 
        }
290
 
        
291
 
        
292
 
        elem=lc->codecs_conf.audio_codecs;
293
 
        while(elem!=NULL){
294
 
                codec=(PayloadType*) elem->data;
295
 
                if (payload_type_usable(codec) && payload_type_enabled(codec)){
296
 
                        
297
 
                        sdp_payload_init(&payload);
298
 
                        payload.a_rtpmap=g_strdup_printf("%s/%i/1",codec->mime_type,codec->clock_rate);
299
 
                        payload.pt=rtp_profile_get_payload_number_from_rtpmap(lc->local_profile,payload.a_rtpmap);
300
 
                        payload.localport=lc->rtp_conf.audio_rtp_port;
301
 
                        /* when setting speex, add a b=<AS>: to choose bitrate */
302
 
                        if (strcmp(codec->mime_type,"speex")==0){
303
 
                                payload.b_as_bandwidth=codec->normal_bitrate/1000;
304
 
                        }
305
 
                        sdp_handler_add_audio_payload(sdph,ctx,&payload);
306
 
                        g_free(payload.a_rtpmap);
307
 
                }
308
 
                elem=g_list_next(elem);
309
 
        }
310
 
        /* add telephone-event payload*/
311
 
        sdp_payload_init(&payload);
312
 
        payload.pt=rtp_profile_get_payload_number_from_mime(lc->local_profile,"telephone-event");
313
 
        payload.a_rtpmap="telephone-event/8000";
314
 
        payload.a_fmtp="0-11";
315
 
        sdp_handler_add_audio_payload(sdph,ctx,&payload);
316
 
        return 0;
317
 
}
318
 
 
319
 
 
320
 
int set_video_offer(SdpHandler *sdph,SdpContext *ctx)
321
 
{
322
 
        LinphoneCore *lc;
323
 
        OsipUA *ua;
324
 
        PayloadType *codec;
325
 
        GList *elem;
326
 
        ua=body_handler_get_ua(BODY_HANDLER(sdph));
327
 
        lc=(LinphoneCore*)ua->data;
328
 
        elem=lc->codecs_conf.video_codecs;
329
 
        while(elem!=NULL){
330
 
                codec=(PayloadType*) elem->data;
331
 
                if (payload_type_usable(codec) && payload_type_enabled(codec)){
332
 
                        SdpPayload payload;
333
 
                        PayloadType *rtpp;
334
 
                        sdp_payload_init(&payload);
335
 
                        payload.a_rtpmap=g_strdup_printf("%s/%i",codec->mime_type,codec->clock_rate);
336
 
                        payload.localport=lc->rtp_conf.video_rtp_port;
337
 
                        sdp_handler_add_video_payload(sdph,ctx,&payload);
338
 
                        g_free(payload.a_rtpmap);
339
 
                }
340
 
                elem=g_list_next(elem);
341
 
        }
342
 
        return 0;
343
 
}
344
 
 
345
 
int payload_is_supported(SdpPayload *payload,RtpProfile *local_profile,RtpProfile *dialog_profile)
346
 
{
347
 
        int localpt;
348
 
        if (payload->a_rtpmap!=NULL){
349
 
                localpt=rtp_profile_get_payload_number_from_rtpmap(local_profile,payload->a_rtpmap);
350
 
        }else{
351
 
                localpt=payload->pt;
352
 
                g_warning("payload has no rtpmap.");
353
 
        }
354
 
        
355
 
        if (localpt>=0){
356
 
                /* this payload is understood, but does the user want to use it ?? */
357
 
                PayloadType *rtppayload;
358
 
                rtppayload=rtp_profile_get_payload(local_profile,localpt);
359
 
                if (rtppayload==NULL) {
360
 
                        g_warning("strange error !!");
361
 
                        return 0;
362
 
                }
363
 
                if (strcmp(rtppayload->mime_type,"telephone-event")!=0){
364
 
                        if (!(payload_type_usable(rtppayload) && payload_type_enabled(rtppayload))) {
365
 
                                g_warning("payload %s is not usable or enabled.",rtppayload->mime_type);
366
 
                                return 0;
367
 
                        }
368
 
                }
369
 
                /* this payload is supported in our local rtp profile, so add it to the dialog rtp
370
 
                profile */
371
 
                rtppayload=payload_type_clone(rtppayload);
372
 
                rtp_profile_set_payload(dialog_profile,payload->pt,rtppayload);
373
 
                /* add to the rtp payload type some other parameters (bandwidth) */
374
 
                if (payload->b_as_bandwidth!=0) rtppayload->normal_bitrate=payload->b_as_bandwidth*1000;
375
 
                return 1;
376
 
        }
377
 
        return 0;
378
 
}
379
 
 
380
 
int accept_audio_offer(SdpHandler *sdph,SdpContext *ctx,SdpPayload *payload)
381
 
{
382
 
        OsipDialog *dialog=BODY_CONTEXT(ctx)->dialog;
383
 
        LinphoneDialogParams *diaparams;
384
 
        LinphoneCore *lc=(LinphoneCore*) BODY_HANDLER(sdph)->ua->data;
385
 
        RtpProfile *remote_profile;
386
 
        StreamParams *params;
387
 
        int supported;
388
 
        if (dialog->data==NULL){
389
 
                diaparams=linphone_dialog_params_new();
390
 
                dialog->data=(void*) diaparams;
391
 
        }else diaparams=(LinphoneDialogParams*)dialog->data;
392
 
        if (diaparams->profile==NULL){
393
 
                /* create a remote user agent profile */
394
 
                diaparams->profile=remote_profile=rtp_profile_new("remote");
395
 
        }else remote_profile=diaparams->profile;
396
 
        /* see if this codec is supported in our local rtp profile*/
397
 
        supported=payload_is_supported(payload,lc->local_profile,remote_profile);
398
 
        if (!supported) {
399
 
                g_message("Refusing codec %i (%s)",payload->pt,payload->a_rtpmap);
400
 
                return -1;
401
 
        }
402
 
        params=&diaparams->audio_params;
403
 
        if (params->initialized==0){
404
 
                /* this is the first codec we may accept*/
405
 
                params->localport=payload->localport=lc->rtp_conf.audio_rtp_port;
406
 
                params->remoteport=payload->remoteport;
407
 
                params->line=payload->line;
408
 
                params->pt=payload->pt; /* remember the first payload accepted */
409
 
                params->remoteaddr=payload->c_addr;
410
 
                params->initialized=1;
411
 
        }else{
412
 
                /* refuse all other audio lines*/
413
 
                if(params->line!=payload->line) return -1;
414
 
        }
415
 
        return 0;
416
 
}
417
 
 
418
 
int accept_video_offer(SdpHandler *sdph,SdpContext *ctx,SdpPayload *payload)
419
 
{
420
 
        OsipDialog *dialog=BODY_CONTEXT(ctx)->dialog;
421
 
        LinphoneDialogParams *diaparams;
422
 
        LinphoneCore *lc=(LinphoneCore*) BODY_HANDLER(sdph)->ua->data;
423
 
        RtpProfile *remote_profile;
424
 
        StreamParams *params;
425
 
        int supported;
426
 
        if (dialog->data==NULL){
427
 
                diaparams=linphone_dialog_params_new();
428
 
                dialog->data=(void*) diaparams;
429
 
        }else diaparams=(LinphoneDialogParams*)dialog->data;
430
 
        if (diaparams->profile==NULL){
431
 
                /* create a remote user agent profile */
432
 
                diaparams->profile=remote_profile=rtp_profile_new("remote");
433
 
        }else remote_profile=diaparams->profile;
434
 
        /* see if this codec is supported in our local rtp profile*/
435
 
        supported=payload_is_supported(payload,lc->local_profile,remote_profile);
436
 
        if (!supported) return -1;
437
 
        params=&diaparams->video_params;
438
 
        if (params->initialized==0){
439
 
                /* this is the first codec we may accept*/
440
 
                params->localport=payload->localport=lc->rtp_conf.video_rtp_port;
441
 
                params->remoteport=payload->remoteport;
442
 
                params->line=payload->line;
443
 
                params->pt=payload->pt; /* remember the first payload accepted */
444
 
                params->remoteaddr=payload->c_addr;
445
 
                params->initialized=1;
446
 
        }else{
447
 
                /* refuse all other audio lines*/
448
 
                if(params->line!=payload->line) return -1;
449
 
        }
450
 
        return 0;
451
 
}
452
 
 
453
 
int read_audio_answer(SdpHandler *sdph,SdpContext *ctx,SdpPayload *payload)
454
 
{
455
 
        OsipDialog *dialog=BODY_CONTEXT(ctx)->dialog;
456
 
        LinphoneDialogParams *diaparams;
457
 
        LinphoneCore *lc=(LinphoneCore*) BODY_HANDLER(sdph)->ua->data;
458
 
        StreamParams *params;
459
 
        int supported;
460
 
        if (dialog->data==NULL){
461
 
                diaparams=linphone_dialog_params_new();
462
 
                dialog->data=(void*) diaparams;
463
 
                diaparams->profile=rtp_profile_clone_full(lc->local_profile);
464
 
        }else diaparams=(LinphoneDialogParams*)dialog->data;
465
 
        /* paranoid check: see if this codec is supported in our local rtp profile*/
466
 
        supported=payload_is_supported(payload,lc->local_profile,diaparams->profile);
467
 
        if (!supported) {
468
 
                g_warning("This remote sip phone did not answer properly to my sdp offer!");
469
 
                return 0;
470
 
        }
471
 
        params=&diaparams->audio_params;
472
 
        if (params->initialized==0){
473
 
                /* this is the first codec we may accept*/
474
 
                params->localport=lc->rtp_conf.audio_rtp_port;
475
 
                params->remoteport=payload->remoteport;
476
 
                params->line=payload->line;
477
 
                params->pt=payload->pt; /* remember the first payload accepted */
478
 
                params->remoteaddr=payload->c_addr;
479
 
                params->initialized=1;
480
 
        }
481
 
}
482
 
 
483
 
int read_video_answer(SdpHandler *sdph,SdpContext *ctx,SdpPayload *payload)
484
 
{
485
 
        OsipDialog *dialog=BODY_CONTEXT(ctx)->dialog;
486
 
        LinphoneDialogParams *diaparams;
487
 
        LinphoneCore *lc=(LinphoneCore*) BODY_HANDLER(sdph)->ua->data;
488
 
        StreamParams *params;
489
 
        int supported;
490
 
        if (dialog->data==NULL){
491
 
                diaparams=linphone_dialog_params_new();
492
 
                dialog->data=(void*) diaparams;
493
 
                diaparams->profile=rtp_profile_clone_full(lc->local_profile);
494
 
        }else diaparams=(LinphoneDialogParams*)dialog->data;
495
 
        /* paranoid check: see if this codec is supported in our local rtp profile*/
496
 
        supported=payload_is_supported(payload,lc->local_profile,diaparams->profile);
497
 
        if (!supported) {
498
 
                g_warning("This remote sip phone did not answer properly to my sdp offer!");
499
 
                return 0;
500
 
        }
501
 
        params=&diaparams->video_params;
502
 
        if (params->initialized==0){
503
 
                /* this is the first codec we may accept*/
504
 
                params->localport=lc->rtp_conf.video_rtp_port;
505
 
                params->remoteport=payload->remoteport;
506
 
                params->line=payload->line;
507
 
                params->pt=payload->pt; /* remember the first payload accepted */
508
 
                params->remoteaddr=payload->c_addr;
509
 
                params->initialized=1;
510
 
        }
511
 
}