MySQL BEFORE INSERT trigger with IF conditions
As @dezso says, you can't compare NULL with arithmetic comparison operators as described in the MySQL's documentation.


  You cannot use arithmetic comparison operators such as =, &lt;, or &lt;> to
  test for NULL. To demonstrate this for yourself, try the following
  query:


mysql&gt; SELECT 1 = NULL, 1 &lt;&gt; NULL, 1 &lt; NULL, 1 &gt; NULL;
+----------+-----------+----------+----------+
| 1 = NULL | 1 &lt;&gt; NULL | 1 &lt; NULL | 1 &gt; NULL |
+----------+-----------+----------+----------+
|     NULL |      NULL |     NULL |     NULL |
+----------+-----------+----------+----------+


Edit this part:

IF NumberHP IS null then # &lt;-- IS replaced =
    insert into smsra_sms
    set idsms = IDx, SendingDateTime = WaktuKirim,
    isi = IsiSMS, pengirim = NumberHP
    ON duplicate key update idsms = idsms + IDx;
ELSE
    insert into smsra_trash
    set Nohp = NumberHP
    ON duplicate key update Nohp = Nohp + NumberHP;
END IF;