<html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <base href="https://wiki.asterisk.org/wiki" />
        <style type="text/css">
    body, #email-content, #email-content-inner { font-family: Arial,FreeSans,Helvetica,sans-serif; }
    body, p, blockquote, pre, code, td, th, li, dt, dd { font-size: 13px; }
    small { font-size: 11px; }

    body { width:100% !important; -webkit-font-smoothing: antialiased; }

    body,
    #email-wrapper { background-color: #f0f0f0; }
    #email-wrapper-inner { padding: 20px; text-align: center; }
    #email-content-inner { background-color: #fff; border: 1px solid #bbb; color: $menuTxtColour; padding:20px; text-align:left; }
    #email-wrapper-inner > table { width: 100%; }
    #email-wrapper-inner.thin > table { margin: 0 auto; width: 50%; }
    #email-footer { padding: 0 16px 32px 16px; margin: 0; }

    .email-indent { margin: 8px 0 16px 0; }
    .email-comment { margin: 0 0 0 56px; }
    .email-comment.removed { background-color: #ffe7e7; border: 1px solid #df9898; padding: 0 8px;}

    #email-title-avatar { text-align: left; vertical-align: top; width: 48px; padding-right: 8px; }
    #email-title-flavor { margin: 0; padding: 0 0 4px 0; }
    #email-title-heading { font-size: 16px; line-height: 20px; min-height: 20px; margin: 0; padding: 0; }
    #email-title .icon { border: 0; padding: 0 5px 0 0; text-align: left; vertical-align: middle; }

    #email-actions { border-top: 1px solid #bbb; color: #505050; margin: 8px 0 0 0; padding: 0; }
    #email-actions td { padding-top: 8px; }
    #email-actions .left { max-width: 45%; text-align: left; }
    #email-actions .right { text-align: right; }
    .email-reply-divider { border-top: 1px solid #bbb; color: #505050; margin: 32px 0 8px 0; padding: 8px 0; }
    .email-section-title { border-bottom: 1px solid #bbb; margin: 8px 0; padding: 8px 0 0 0; }

    .email-metadata { color: #505050; }

    a { color: #326ca6; text-decoration: none; }
    a:hover { color: #336ca6; text-decoration: underline; }
    a:active {color: #326ca6; }

    a.email-footer-link { color: #505050; font-size: 11px; }

    .email-item-list { list-style: none; margin: 4px 0; padding-left: 0; }
    .email-item-list li { list-style: none; margin: 0; padding: 4px 0; }
    .email-list-divider { color: #505050; padding: 0 0.35em; }
    .email-operation-icon { padding-right: 5px; }

    .avatar { -ms-interpolation-mode: bicubic; border-radius: 3px;}
    .avatar-link { margin: 2px; }

    .tableview th { border-bottom: 1px solid #69C; font-weight: bold; text-align: left; }
    .tableview td { border-bottom: 1px solid #bbbbbb; text-align: left; padding: 4px 16px 4px 0; }

    .aui-message {  margin: 1em 0; padding: 8px; }
    .aui-message.info { background-color: #e0f0ff; border: 1px solid #9eb6d4; }
    .aui-message.success { background-color: #ddfade; border: 1px solid #93c49f; }
    .aui-message.error,
    .aui-message.removed { background-color: #ffe7e7; border: 1px solid #df9898; color: #000; }

    .call-to-action-table { margin: 10px 1px 1px 1px;}
    .call-to-cancel-container, .call-to-action-container { padding: 5px 20px; }
    .call-to-cancel-container { border: 1px solid #aaa; background-color: #eee; border-radius: 3px; }
    .call-to-cancel-container a.call-to-cancel-button { background-color: #eee; font-size: 14px; line-height: 1; padding: 0; margin: 0; color: #666; font-family: sans-serif;}
    .call-to-action-container { border: 1px solid #486582;  background-color: #3068A2; border-radius: 3px; padding: 4px 10px; }
    .call-to-action-container a.call-to-action-button { background-color: #3068A2; font-size: 14px; line-height: 1; padding: 0; margin: 0; color: #fff; font-weight: bold; font-family: sans-serif; }

    /** The span around the inline task checkbox image */
    .diff-inline-task-overlay {
        display: inline-block;
        text-align: center;
        height: 1.5em;
        padding: 5px 0px 1px 5px;
        margin-right: 5px;
        /** Unfortunately, the negative margin-left is stripped out in gmail */
        margin-left: -5px;
    }

            @media handheld, only screen and (max-device-width: 480px) {
        div, a, p, td, th, li, dt, dd { -webkit-text-size-adjust: auto; }
        small, small a { -webkit-text-size-adjust: 90%; }

        td[id=email-wrapper-inner] { padding: 2px !important; }
        td[id=email-content-inner] { padding: 8px !important; }
        td[id="email-wrapper-inner"][class="thin"] > table { text-align: left !important; width: 100% !important; }
        td[id=email-footer] { padding: 8px 12px !important; }
        div[class=email-indent] { margin: 8px 0px !important; }
        div[class=email-comment] { margin: 0 !important; }

        p[id=email-title-flavor] a { display: block; } /* puts the username and the action on separate lines */
        p[id=email-permalink] { padding: 4px 0 0 0 !important; }

        table[id=email-actions] td { padding-top: 0 !important; }
        table[id=email-actions] td.right { text-align: right !important; }
        table[id=email-actions] .email-list-item { display: block; margin: 1em 0 !important; word-wrap: normal !important; }
        span[class=email-list-divider] { display: none; }
    }



        </style>
    </head>
    <body style="font-family: Arial, FreeSans, Helvetica, sans-serif; font-size: 13px; width: 100%; -webkit-font-smoothing: antialiased; background-color: #f0f0f0">
        <table id="email-wrapper" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: #f0f0f0">
            <tbody>
                <tr valign="middle">
                    <td id="email-wrapper-inner" style="font-size: 13px; padding: 20px; text-align: center">
                        <table id="email-content" cellspacing="0" cellpadding="0" border="0" style="font-family: Arial, FreeSans, Helvetica, sans-serif; width: 100%">
                            <tbody>
                                <tr valign="top">
                                    <td id="email-content-inner" align="left" style="font-family: Arial, FreeSans, Helvetica, sans-serif; font-size: 13px; background-color: #fff; border: 1px solid #bbb; padding: 20px; text-align: left">
                                        <table id="email-title" cellpadding="0" cellspacing="0" border="0" width="100%">
                                            <tbody>
                                                <tr>
                                                    <td id="email-title-avatar" rowspan="2" style="font-size: 13px; text-align: left; vertical-align: top; width: 48px; padding-right: 8px"> <img class="avatar" src="cid:avatar_a25fbf8466474d2c6e78adaa29880def" border="0" height="48" width="48" style="-ms-interpolation-mode: bicubic; border-radius: 3px" /> </td>
                                                    <td valign="top" style="font-size: 13px">
                                                        <div id="email-title-flavor" class="email-metadata" style="margin: 0; padding: 0 0 4px 0; color: #505050">
                                                            <a href="    https://wiki.asterisk.org/wiki/display/~mdavenport " style="color:#326ca6;text-decoration:none;; color: #326ca6; text-decoration: none">Malcolm Davenport</a> edited the page:
                                                        </div> </td>
                                                </tr>
                                                <tr>
                                                    <td valign="top" style="font-size: 13px"> <h2 id="email-title-heading" style="font-size: 16px; line-height: 20px; min-height: 20px; margin: 0; padding: 0"> <a href="https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime" style="color: #326ca6; text-decoration: none"> <img class="icon" src="cid:page-icon" alt="" style="border: 0; padding: 0 5px 0 0; text-align: left; vertical-align: middle" /> <strong style="font-size:16px;line-height:20px;vertical-align:top;">Setting up PJSIP Realtime</strong> </a> </h2> </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <div class="email-indent" style="margin: 8px 0 16px 0">
                                            <p class="aui-message info" style="font-size: 13px; margin: 1em 0; padding: 8px; background-color: #e0f0ff; border: 1px solid #9eb6d4"> <b>Comment:</b> a large update to improve the situation for everyone </p>
                                            <div class="email-diff">
                                                <div id="page-diffs" class="wiki-content">
                                                    <h1 id="SettingupPJSIPRealtime-toc" class="diff-block-target diff-block-context">
                                                        <table class="diff-macro bodyless diff-html-added" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;margin: 5px 0; padding: 0; width: auto;background-color: #ddfade;border-color: #93c49f;">
                                                            <thead>
                                                                <tr>
                                                                    <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" id="added-diff-0" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/toc.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Table of Contents</span></th>
                                                                </tr>
                                                            </thead>
                                                        </table> </h1>
                                                    <h1 id="SettingupPJSIPRealtime-Overview" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Overview</span> </h1>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">This tutorial describes the configuration of Asterisk's PJSIP channel driver with the "realtime" database storage backend.  The realtime interface allows storing much of the configuration of PJSIP in a database, as opposed to the normal flat-file storage of pjsip.conf.</span> </p>
                                                    <h2 id="SettingupPJSIPRealtime-InstallingDependencies" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Installing Dependencies</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">For the purposes of this tutorial, we will assume a base Ubuntu 12.0.4.3 x86_64 server installation, with the OpenSSH server and LAMP server options, and that Asterisk will use its </span><a href="http://www.unixodbc.org/" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">ODBC</span></a><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> connector to reach a back-end </span><a href="http://www.mysql.com/" class="external-link" rel="nofollow" style="color: #326ca6; text-decoration: none"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">MySQL</span></a><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> database.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Beyond the normal packages needed to install Asterisk 12 on such a server (build-essential, libncurses5-dev, uuid-dev, libjansson-dev, libxml2-dev, libsqlite3-dev) as well as the </span><a href="https://wiki.asterisk.org/wiki/display/AST/Installing+pjproject" rel="nofollow" style="color: #326ca6; text-decoration: none"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Installation of pjproject</span></a><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">, you will need to install the following packages:</span> </p>
                                                    <ul class="diff-block-target diff-block-context">
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">unixodbc and unixodbc-dev</span>
                                                            <ul>
                                                                <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">ODBC and the development packages for building against ODBC</span> </li>
                                                            </ul> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">libmyodbc</span>
                                                            <ul>
                                                                <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">The ODBC to MySQL interface package</span> </li>
                                                            </ul> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">python-dev and python-pip</span>
                                                            <ul>
                                                                <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">The Python development package and the pip package to allow installation of Alembic</span> </li>
                                                            </ul> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">python-mysqldb</span>
                                                            <ul>
                                                                <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">The Python interface to MySQL, which will be used by Alembic to generate the database tables</span> </li>
                                                            </ul> </li>
                                                    </ul>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">So, from the CLI, perform:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># apt-get install unixodbc unixodbc-dev libmyodbc python-dev python-pip python-mysqldb</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Once these packages are installed, check your Asterisk installation's </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">make menuconfig</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> tool to make sure that the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">res_config_odbc</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> and </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">res_odbc</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> resource modules, as well as the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">res_pjsip_xxx</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> modules are selected for installation.  If they are, then go through the normal Asterisk installation process: </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">./configure; make; make install</span></strong> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">And, if this is your first installation of Asterisk, be sure to install the sample files: </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">make samples</span></strong> </p>
                                                    <h2 id="SettingupPJSIPRealtime-CreatingtheMySQLDatabase" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Creating the MySQL Database</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Use the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">mysqladmin</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> tool to create the database that we'll use to store the configuration.  From the Linux CLI, perform:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># mysqladmin -u root -p create asterisk</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">This will prompt you for your MySQL databaes password and then create a database named </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">asterisk</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> that we'll use to store our PJSIP configuration.</span> </p>
                                                    <h2 id="SettingupPJSIPRealtime-InstallingandUsingAlembic" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Installing and Using Alembic</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Alembic is a full database migration tool, with support for upgrading the schemas of existing databases, versioning of schemas, creation of new tables and databases, and a whole lot more.  A good guide on using Alembic with Asterisk can be found on the </span><a class="confluence-link unresolved" href="#" style="color: #326ca6; text-decoration: none"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Managing Realtime Databases with Alembic</span></a><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> wiki page.  A shorter discussion of the steps necessary to prep your database will follow.</span></span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">First, install Alembic:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">pip install alembic</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span style="background-color: transparent;line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Then, move to the Asterisk source directory containing the Alembic scripts:</span></span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># cd contrib/ast-db-manage/</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Next, edit the config.ini.sample file and change the sqlalchemy.url option, e.g.</span></span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">sqlalchemy.url = mysql://root:password@localhost/asterisk</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Such that the URL matches the username and password required to access your database.</span></span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Then rename the config.ini.sample file to config.ini</span></span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># cp config.ini.sample config.ini</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Finally, use Alembic to setup the database tables:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># alembic -c config.ini upgrade head</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">You'll see something similar to:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">digium@mdlapubuntu:~/code/asterisk-12.0.0-beta2/contrib/ast-db-manage$ alembic -c config.ini upgrade head
INFO  [alembic.migration] Context impl MySQLImpl.
INFO  [alembic.migration] Will assume non-transactional DDL.
INFO  [alembic.migration] Running upgrade None -> 4da0c5f79a9c, Create tables
INFO  [alembic.migration] Running upgrade 4da0c5f79a9c -> 43956d550a44, Add tables for pjsip
digium@mdlapubuntu:~/code/asterisk-12.0.0-beta2/contrib/ast-db-manage$ </span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">You can then connect to MySQL to see that the tables were created:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># mysql -u root -p -D asterisk

mysql> show tables;
+--------------------+
| Tables_in_asterisk |
+--------------------+
| alembic_version    |
| iaxfriends         |
| meetme             |
| musiconhold        |
| ps_aors            |
| ps_auths           |
| ps_contacts        |
| ps_domain_aliases  |
| ps_endpoint_id_ips |
| ps_endpoints       |
| sippeers           |
| voicemail          |
+--------------------+
12 rows in set (0.00 sec)
mysql> quit</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <h2 id="SettingupPJSIPRealtime-ConfiguringODBC" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Configuring ODBC</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now that we have our MySQL database created and populated, we'll need to setup ODBC and Asterisk's ODBC resource to access the database.  First, we'll tell ODBC how to connect to MySQL.  To do this, we'll edit the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/odbcinst.ini</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> configuration file.  Your file should look something like:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">title</span></td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/odbcinst.ini</span></td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
UsageCount = 2</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Next, we'll tell ODBC </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">which</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> MySQL database to use.  To do this, we'll edit the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/odbc.ini</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> configuration file and create a database handle called </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">asterisk</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">.  Your file should look something like:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">title</span></td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/odbc.ini</span></td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">[asterisk]
Driver = MySQL
Description = MySQL connection to ‘asterisk’ database
Server = localhost
Port = 3306
Database = asterisk
UserName = root
Password = password
Socket = /var/run/mysqld/mysqld.sock</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Take care to use your database access UserName and Password, and not necessarily what's defined in this example.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now, we need to configure Asterisk's ODBC resource, res_odbc, to connect to the ODBC </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">asterisk</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> database handle that we just created.  res_odbc is configured using the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/res_odbc.conf</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> configuration file.  There, you'll want:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">title</span></td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/res_odbc.conf</span></td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">[asterisk]
enabled => yes
dsn => asterisk
username => root
password => password
pre-connect => yes</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Again, take care to use the proper username and password.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now, you can start Asterisk and you can check its connection to your "asterisk" MySQL database using the "asterisk" res_odbc connector to ODBC.  You can do this by executing "odbc show" from the Asterisk CLI.  If everything went well, you'll see:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># asterisk -vvvvc
*CLI> odbc show
 
ODBC DSN Settings
-----------------
 Name: asterisk
 DSN:    asterisk
 Last connection attempt: 1969-12-31 18:00:00
 Pooled: No
 Connected: Yes
*CLI> </span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <h2 id="SettingupPJSIPRealtime-ConnectingPJSIPSorcerytotheRealtimeDatabase" class="diff-block-target diff-block-context"> <span style="background-color: transparent;color: rgb(133,120,102);font-family: MuseoSans500 , sans-serif;font-size: 20.0px;line-height: 1.5;"><span class="diff-html-changed" id="changed-diff-0" style="background-color: #d6f0ff;">Connecting PJSIP Sorcery to the Realtime Database</span></span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px">The PJSIP stack uses a new data abstraction layer in Asterisk called <strong>sorcery</strong>. Sorcery lets a user build a hierarchical layer of data sources for Asterisk to use when it retrieves, updates, creates, or destroys data that it interacts with. This tutorial focuses on <span class="diff-html-removed" id="removed-diff-0" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">adding hooks from sorcery to Asterisk's Realtime Architecture for PJSIP</span><span class="diff-html-added" id="added-diff-1" style="font-size: 100%; background-color: #ddfade;">getting PJSIP's configuration stored in a realtime back-end</span>; the rest of the details of sorcery are beyond the scope of this page.</p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-removed" id="removed-diff-1" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">This tutorial assumes you have already connected your database to Asterisk in the past and that your backend configuration (res_odbc.conf, res_config_mysql.conf, etc.) is already setup to connect to your database. That being the case, you'll still need to modify extconfig.conf and sorcery.conf in order to make PJSIP be able to connect to the database and apply the correct tables to the sorcery objects that are responsible for managing their data within Asterisk.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Open sorcery.conf (</span><span class="diff-html-added" id="added-diff-2" style="font-size: 100%; background-color: #ddfade;">PJSIP bases its configuration on types of objects.  For more information about these types of objects, please refer to the </span><a class="confluence-link unresolved" href="#" style="color: #326ca6; text-decoration: none"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Configuring res_pjsip</span></a><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> wiki page.  In this case, we have a total of five objects we need to configure in Sorcery:</span> </p>
                                                    <ul class="diff-block-target diff-block-context">
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">endpoint</span> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">auth</span> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">aor</span> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">domain</span> </li>
                                                        <li style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">identify</span> </li>
                                                    </ul>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Sorcery is configured using the </span><strong><span class="diff-html-changed" id="changed-diff-2" style="background-color: #d6f0ff;">/etc/asterisk/sorcery.conf</span></strong><span class="diff-html-removed" id="removed-diff-2" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">) in a text editor and </span><span class="diff-html-added" id="added-diff-3" style="font-size: 100%; background-color: #ddfade;">configuration file.  So, we need to </span>add the following lines <span class="diff-html-removed" id="removed-diff-3" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">at </span><span class="diff-html-added" id="added-diff-4" style="font-size: 100%; background-color: #ddfade;">to </span>the <span class="diff-html-removed" id="removed-diff-4" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">end of the </span>file:</p>
                                                    <table class="diff-macro diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">title</td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">sorcery.conf</td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">language</td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">text</td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">[res_pjsip] ; Realtime PJSIP configuration wizard
endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
identify=realtime,ps_endpoint_id_ips</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-context-placeholder" style="font-size: 13px">...</p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px">In our case, the <code style="font-size: 13px">sorcery_wizard_name</code><span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;"> </span><span class="diff-html-removed" id="removed-diff-5" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">is </span><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> </span><span class="diff-html-added" id="added-diff-5" style="font-size: 100%; background-color: #ddfade;">is </span><strong><span class="diff-html-changed" id="changed-diff-3" style="background-color: #d6f0ff;">realtime</span></strong>, <span class="diff-html-removed" id="removed-diff-6" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">while </span><span class="diff-html-added" id="added-diff-6" style="font-size: 100%; background-color: #ddfade;">and </span>the <strong><span class="diff-html-changed" id="changed-diff-4" style="background-color: #d6f0ff;">wizard_arguments</span></strong><span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;"> </span><span class="diff-html-removed" id="removed-diff-7" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">are </span><span class="diff-html-added" id="added-diff-7" style="font-size: 100%; background-color: #ddfade;"> are </span>the name of the database connector <span class="diff-html-added" id="added-diff-8" style="font-size: 100%; background-color: #ddfade;">("asterisk") </span>to associate with <span class="diff-html-removed" id="removed-diff-8" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">this </span><span class="diff-html-added" id="added-diff-9" style="font-size: 100%; background-color: #ddfade;">our </span><span class="diff-html-changed" id="changed-diff-5" style="background-color: #d6f0ff;">object </span><span class="diff-html-removed" id="removed-diff-9" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">_type.PJSIP bases its configuration on types of objects; in this case, we have a total of five objects we need to configure: endpoint, auth, aor, domain, and identify. </span><span class="diff-html-added" id="added-diff-10" style="font-size: 100%; background-color: #ddfade;">types.</span> </p>
                                                    <h2 id="SettingupPJSIPRealtime-RealtimeConfiguration" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Realtime Configuration</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px">Since we've associated <span class="diff-html-removed" id="removed-diff-10" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">them </span><span class="diff-html-added" id="added-diff-11" style="font-size: 100%; background-color: #ddfade;">the PJSIP objects </span>with database connector types, we now need to <span class="diff-html-removed" id="removed-diff-11" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">update our </span><span class="diff-html-added" id="added-diff-12" style="font-size: 100%; background-color: #ddfade;">tell Asterisk to use a database backend with the object types, and not just the flat pjsip.conf file.  To do this, we modify the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/</span><span class="diff-html-changed" id="changed-diff-6" style="background-color: #d6f0ff;">extconfig.conf</span></strong><span class="diff-html-changed" style="background-color: #d6f0ff;"> </span><span class="diff-html-added" id="added-diff-13" style="font-size: 100%; background-color: #ddfade;">configuration file </span>to provide <span class="diff-html-removed" id="removed-diff-12" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">those </span><span class="diff-html-added" id="added-diff-14" style="font-size: 100%; background-color: #ddfade;">these </span>connections.</p>
                                                    <p class="diff-block-context" style="font-size: 13px">Open extconfig.conf (/etc/asterisk/extconfig.conf) and add the following lines to the 'settings' configuration section</p>
                                                    <table class="diff-macro diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">title</td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">extconfig.conf</td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">language</td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">text</td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">ps_endpoints => odbc,asterisk
ps_auths => odbc,asterisk
ps_aors => odbc,asterisk
ps_domain_aliases => odbc,asterisk
ps_endpoint_id_ips => odbc,asterisk</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-removed" id="removed-diff-13" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">And if necessary, replace 'odbc' with the actual backend used (odbc, mysql, sqlite3, pgsql, etc) and replace asterisk with the the appropriately named database connector name.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px">At this point, Asterisk <span class="diff-html-removed" id="removed-diff-14" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">should be </span><span class="diff-html-added" id="added-diff-15" style="font-size: 100%; background-color: #ddfade;">is nearly </span>ready to use the tables created by alembic with PJSIP to configure endpoints, authorization, AORs, domain aliases, and endpoint identifiers.</p>
                                                    <table class="diff-macro diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/warning.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Warning</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">title</td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px">A warning for adventurous types:</td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <p style="font-size: 13px">Sorcery.conf allows you to try to configure other PJSIP objects such as transport using realtime and it currently won't stop you from doing so. However, some of these object types should not be used with realtime and this can lead to errant behavior.</p> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <h2 id="SettingupPJSIPRealtime-AsteriskStartupConfiguration" class="diff-block-target diff-block-context"> <span class="diff-html-added" id="added-diff-16" style="font-size: 100%; background-color: #ddfade;">Asterisk Startup Configuration</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now, we need to configure Asterisk to load its ODBC driver at an early stage of startup, so that it's available when any other modules might need to take advantage of it.  Also, we're going to prevent the old chan_sip channel driver from loading, since we're only worried about PJSIP.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">To do this, edit the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/modules.conf</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> configuration file.  In the </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">[modules]</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> section, add the following lines:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">title</span></td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">modules.conf</span></td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">preload => res_odbc.so
preload => res_config_odbc.so
noload => chan_sip.so </span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <h2 id="SettingupPJSIPRealtime-AsteriskPJSIPconfiguration" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Asterisk PJSIP configuration</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Next, we need to configure a transport in </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/pjsip.conf</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">.  PJSIP transport object types are not stored in realtime as unexpected results can occur.  So, edit it and add the following lines:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Here, we created a transport called </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">transport-udp</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> that we'll reference in the next section.</span> </p>
                                                    <h2 id="SettingupPJSIPRealtime-EndpointPopulation" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Endpoint Population</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now, we need to create our endpoints inside of the database.  For this example, we'll create two peers, 101 and 102, that register using the totally insecure passwords "101" and "102" respectively.  Here, we'll be populating data directly into the database using the MySQL interactive tool.</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># mysql -u root -p -D asterisk;
mysql> insert into ps_aors (id, max_contacts) values (101, 1);
mysql> insert into ps_aors (id, max_contacts) values (102, 1);
mysql> insert into ps_auths (id, auth_type, password, username) values (101, 'userpass', 101, 101);
mysql> insert into ps_auths (id, auth_type, password, username) values (102, 'userpass', 102, 102);
mysql> insert into ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media) values (101, 'transport-udp', '101', '101', 'testing', 'all', 'g722', 'no');
mysql> insert into ps_endpoints (id, transport, aors, auth, context, disallow, allow, direct_media) values (102, 'transport-udp', '102’, '102’, 'testing', 'all', 'g722', 'no');
mysql> quit;</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">In this example, we first created an </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">aor</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> for each peer, one called </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">101</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> and the other </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">102</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Next, we created an </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">auth</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> for each peer with a userpath of </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">101</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> and </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">102</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">.</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Then, we created two endpoints, </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">101</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> and </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">102</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">, each referencing the appropriate </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">auth</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> and </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">aor</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">, and we elected for the G.722 codec and we forced media to route inside of Asterisk (not the default behavior of Asterisk).</span> </p>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now, you can start Asterisk and you can check to see if it's finding your PJSIP endpoints in the database.  You can do this by executing "pjsip show endpoints" from the Asterisk CLI.  If everything went well, you'll see:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/images/icons/macrobrowser/dropdown/noformat.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>No Format</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"># asterisk -vvvvc
*CLI> pjsip show endpoints
Endpoints:
101
102
*CLI> </span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <h2 id="SettingupPJSIPRealtime-ALittleDialplan" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">A Little Dialplan</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now that we have our PJSIP endpoints stored in our MySQL database, let's add a little dialplan so that they can call each other.  To do this, edit Asterisk's </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/extensions.conf</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> file and add the following lines to the end:</span> </p>
                                                    <table class="diff-macro diff-html-added diff-block-target diff-block-context" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;background-color: #ddfade;border-color: #93c49f;">
                                                        <thead>
                                                            <tr>
                                                                <th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4252/6ac85e9b14675c5514a674e1aecae99c9505ed36.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</span></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; font-size: 13px">
                                                                    <table>
                                                                        <tbody>
                                                                            <tr>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">title</span></td>
                                                                                <td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; font-size: 13px"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">/etc/asterisk/extensions.conf</span></td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table> </td>
                                                            </tr>
                                                        </tbody>
                                                        <tbody>
                                                            <tr>
                                                                <td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; font-size: 13px"> <pre style="font-size: 13px">
<span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">[testing]
exten => _1XX,1,NoOp()
same => n,Dial(PJSIP/${EXTEN})</span>
</pre> </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                    <h2 id="SettingupPJSIPRealtime-Conclusion" class="diff-block-target diff-block-context"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Conclusion</span> </h2>
                                                    <p class="diff-block-target diff-block-context" style="font-size: 13px"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Now, start Asterisk back up, or reload it using </span><strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">core reload</span></strong><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> from the Asterisk CLI, register your two SIP phones using the 101/101 and 102/102 credentials, and make a call.</span> </p>
                                                </div>
                                            </div>
                                        </div>
                                        <table id="email-actions" class="email-metadata" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-top: 1px solid #bbb; color: #505050; margin: 8px 0 0 0; padding: 0; color: #505050">
                                            <tbody>
                                                <tr>
                                                    <td class="left" valign="top" style="font-size: 13px; padding-top: 8px; max-width: 45%; text-align: left"> <span class="email-list-item"><a href="https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime" style="color: #326ca6; text-decoration: none">View Online</a> </span> <span class="email-list-divider" style="color: #505050; padding: 0 0.350em">·</span> <span class="email-list-item"><a href="https://wiki.asterisk.org/wiki/plugins/likes/like.action?contentId=26478274" style="color: #326ca6; text-decoration: none">Like</a> </span> <span class="email-list-divider" style="color: #505050; padding: 0 0.350em">·</span> <span class="email-list-item"><a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=26478274&revisedVersion=4&originalVersion=3" style="color: #326ca6; text-decoration: none">View Changes</a> </span> <span class="email-list-divider" style="color: #505050; padding: 0 0.350em">·</span> <span class="email-list-item"><a href="https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime?showComments=true&showCommentArea=true#addcomment" style="color: #326ca6; text-decoration: none">Add Comment</a> </span> </td>
                                                    <td class="right" width="50%" valign="top" style="font-size: 13px; padding-top: 8px; text-align: right"> <span class="email-list-item"><a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST" style="color: #326ca6; text-decoration: none">Stop watching space</a> </span> <span class="email-list-divider" style="color: #505050; padding: 0 0.350em">·</span> <span class="email-list-item"><a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action" style="color: #326ca6; text-decoration: none">Manage Notifications</a> </span> </td>
                                                </tr>
                                            </tbody>
                                        </table> </td>
                                </tr>
                            </tbody>
                        </table> </td>
                </tr>
                <tr>
                    <td id="email-footer" align="center" style="font-size: 13px; padding: 0 16px 32px 16px; margin: 0"> <small style="font-size: 11px"> This message was sent by <a class="email-footer-link" style="color:#505050;font-size:11px;text-decoration:none;; color: #326ca6; text-decoration: none; color: #505050; font-size: 11px" href="http://www.atlassian.com/software/confluence">Atlassian Confluence</a> 5.1.5, <a class="email-footer-link" style="color:#505050;font-size:11px;text-decoration:none;; color: #326ca6; text-decoration: none; color: #505050; font-size: 11px" href="http://www.atlassian.com/software/confluence/overview/team-collaboration-software?utm_source=email-footer">Team Collaboration Software</a> </small> </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>