~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/iax2/iax.c

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
#ifndef MACOSX
80
80
#include <malloc.h>
81
 
#ifndef SOLARIS
 
81
#if !defined(SOLARIS) && !defined(__ANDROID__)
82
82
#include <error.h>
83
83
#endif
84
84
#endif
499
499
{
500
500
        jb_info stats;
501
501
 
502
 
        if(!iax_session_valid(session)) return -1;
 
502
        if(!session || !iax_session_valid(session)) return -1;
503
503
 
504
504
        *rtt = session->pingtime;
505
505
 
1843
1843
        struct iax_session *session = (struct iax_session *)s;
1844
1844
 
1845
1845
        /* important, eh? */
1846
 
        if(!iax_session_valid(session)) return;
 
1846
        if(!session || !iax_session_valid(session)) return;
1847
1847
 
1848
1848
        send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
1849
1849
        session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, ping_time * 1000);
2456
2456
        }
2457
2457
}
2458
2458
 
 
2459
static void
 
2460
copy_sockaddr_in(struct sockaddr_in *dest, struct sockaddr_in *src)
 
2461
{
 
2462
    dest->sin_port = src->sin_port;
 
2463
    dest->sin_addr = src->sin_addr;
 
2464
    dest->sin_family = AF_INET; /* it's always AF_INET */
 
2465
}
 
2466
 
2459
2467
static struct iax_event *iax_header_to_event(struct iax_session *session, struct ast_iax2_full_hdr *fh, int datalen, struct sockaddr_in *sin)
2460
2468
{
2461
2469
        struct iax_event *e;
2764
2772
                                        /* so a full voice frame is sent on the
2765
2773
                                           next voice output */
2766
2774
                                        session->svoiceformat = -1;
2767
 
                                        session->transfer = *e->ies.apparent_addr;
2768
 
                                        session->transfer.sin_family = AF_INET;
 
2775
 
 
2776
                    /* don't shallow copy struct by assignment (this avoids
 
2777
                     * unaligned accesses) */
 
2778
                    copy_sockaddr_in(&session->transfer, e->ies.apparent_addr);
 
2779
 
2769
2780
                                        session->transfercallno = e->ies.callno;
2770
2781
                                        session->transferring = TRANSFER_BEGIN;
2771
2782
                                        session->transferid = e->ies.transferid;
2781
2792
                                break;
2782
2793
                        case IAX_COMMAND_TXCNT:
2783
2794
                                if (session->transferring)  {
2784
 
                                        session->transfer = *sin;
 
2795
                                        copy_sockaddr_in(&session->transfer, sin);
2785
2796
                                        iax_send_txaccept(session);
2786
2797
                                }
2787
2798
                                free(e);