TIPS BulkVS and SMS with 3CX

Wonder if BulkVS is interested in Pay-to-Play...
From what I've heard, I'm sure that's the issue.

I set up Bulkvs on 3CX over a year ago without too much effort. My setup varies a bit from the instructions posted in this thread but either way will work.

1657743140658.png
 
Is anyone here using BulkVS and 3CX and some how has SMS working? Perhaps with another trunk provider? I really like the pricing of BulkVS especially compared to the pricing of 3CX supported partners who look to be 4 times the cost of BulkVS. Not all of our extensions require messaging so I wonder if anyone is using 3cx with a hybrid set up and using a different trunk provider for extensions that require sms or any other suggested methods for situations like this.
 
I have bulkvs calls working perfectly fine with 3cx.

Also, I have incoming SMS configured from BulkVS, but for that you need to add a page on your website with custom php code to convert sms to email. It's possible to send SMS by email to sms too, but I haven't had time to prepare php code for that.

My website is Wordpress based, so, it was very easy for me to add a page. Below is the perfectly working code if anyone wishes to use.

Apparently, you need to be php programmer to use and change below code.

Create a page on your website and add the page URL to SMS webhook on bulkvs. when sms is received, bulkvs will send POST request to this page and the page is ready to process it.

Hope this helps.

Code:
// shortcode custom page
add_shortcode( 'whatever-sms', 'shortcode_to_receive_sms_to_email' );

// Shortcode implementation function
function shortcode_to_receive_sms_to_email() {
    
    $json = file_get_contents('php://input');

    // Let's convert it into a PHP object:
    $data = json_decode($json);

    // Let's feed the JSON data into variables:
    
    if ( !empty($data->From) && !empty($data->To[0]) && !empty($data->Message) ) {
        // Let's determine the IP address of the gateway which rallied this SMS to our server:
        // whether ip is from share internet
        /**if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip_address = $_SERVER['HTTP_CLIENT_IP'];
        }
        // whether ip is from proxy
        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        // whether ip is from remote address
        else {
            $ip_address = $_SERVER['REMOTE_ADDR'];
        }*/
        
        $from_phone_number = preg_replace( '/[^0-9]/', '', $data->From );
        $to_phone_number = preg_replace( '/[^0-9]/', '', $data->To[0] );
        $message = sanitize_text_field( urldecode($data->Message) );
        
        //below email to can either be hardcoded or pulled from database. I have a list of phone numbers and matching emails store in database.
        $email_to = ; '[email protected]'//this is searched from database, it depends how you have strored phone number and matching email

        $from_email = '[email protected]';
                
        $email_subject = "SMS From:".$from_phone_number."_To:".$to_phone_number; //SMS_GWIP:".$ip_address."_
        
        if( !empty($email_to) && !empty($from_phone_number) && !empty($to_phone_number) && !empty($message) ) {
            
            $success = wp_mail($email_to, $email_subject, $message, $email_headers);
            if($success) {
                echo "OK";
                
                //below is Wordpress specific to insert every sent sms into database for log purpose
                global $wpdb;
                $sms_table = $wpdb->prefix . 'table_name';
                $currentdate = new DateTime( 'NOW', wp_timezone() );
                $current_date = $currentdate->format('Y-m-d H:i:d');
                $success = empty($success)?0:1;
                $success = $wpdb->insert( $sms_table, array( 'from_number' => $from_phone_number,
                                                                    'to_number' => $to_phone_number,
                                                                        'message' => $message,
                                                                            'receive_date' => $current_date,
                                                                                'email_sent' => $success ),
                                                                            array( '%s', '%s', '%s', '%s', '%d' )
                                    );
                
                if( !$success || $wpdb->last_error != '' ) {
                //    $this->wpdb->print_error();
                    //wp_mail($from_email, $email_subject, 'error'.$wpdb->last_error, $email_headers);
                    ?>
                    <div class="error notice is-dismissible"><p><strong><?php _e( 'Oops, Data failed to save! Check settings or data you provided!', 'text-domain' ); ?></strong></p></div> <?php
                    
                }    else {
                    //wp_mail($from_email, $email_subject, 'success', $email_headers);
                    ?>
                    <div class="updated notice is-dismissible"><p><strong><?php _e( 'Success! A record has been added!', 'text-domain' ); ?></strong></p></div> <?php
                }
                
                
            } else {
                echo "ERROR";
            }
        } else {
            echo "ERROR";
            //die( 'No script kiddies please!' );
            echo "Ready to process valid numbers.";
        } // End else
        
    } else {
        echo "ERROR";
        //die( 'No script kiddies please!' );
        echo "Ready to process valid numbers.";
    } // End else
}
 
Thanks! This is a good solution. Would be nice to have users make and receive messages using the 3cx app, but your solution might be a good alternative.
 
3CX recently announced third party Messaging SMS/MMS API support which can be seen here. You will now be able to send and receive messages using your Bulk Solutions numbers without the need for a secondary system to handle messaging, 3CX could now handle both your voice and messaging.

Inbound:
You will use the webhook provided to you by the 3CX instructions under "How to Configure your trunk step 5" and select the 3CX for the Method from the default POST

Outbound:
You will send outbound messages to the following API: https://portal.bulkvs.com/api/v1.0/messageSend?pbx=3cx

Detailed information could also be seen by going to Messaging -> Messaging Instructions -> 3CX.

Question?

Call 855-906-0901 or email [email protected]
 

Members online

Forum statistics

Threads
26,696
Messages
174,453
Members
20,265
Latest member
irenelanda64
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top